如何阅读以下网址:
本地主机/的index.php?ERRORMSG = wrongpassword
所以我希望它将变量$ errormsg设置为'wrongpassword'我该怎么做?我很确定有一种方法可以使用$ _GET或$ _POST吗?
答案 0 :(得分:0)
$errormsg = $_GET['errormsg']
这应该是你的伎俩
答案 1 :(得分:0)
$_GET['errormsg']
是您问题的答案。
答案 2 :(得分:0)
您想使用$_GET['errormsg']
。
这样的事情应该做:
if isset($_GET['errormsg'])
{
echo $_GET['errormsg'];
}
答案 3 :(得分:0)
print_r($_GET)
查看URL中的所有变量。在这种情况下你想要
$_GET['errormsg']
答案 4 :(得分:0)
你和以往一样亲密。一个谷歌会给你答案:)
http://php.net/manual/en/reserved.variables.get.php
<?php
// use htmlspecialchars() to clean up url-encoded characters
$error_message = htmlspecialchars($_GET["errormsg"]);
echo 'Error: ' . $error_message;
?>
prints: "Error: error_here"
,如果网址为...?errormsg=error_here