Home > Backend Development > PHP Tutorial > 新手提问:怎么改变get的内容,页面没有改变啊

新手提问:怎么改变get的内容,页面没有改变啊

WBOY
Release: 2016-06-23 14:28:13
Original
933 people have browsed it

<?phprequire 'Inc/function.php';header("Expires:-1");header("Cache-Control:no-cache");header("Pragma:no-cache");$user=$_POST["user"];if (isset($user)){	echo("0||");	}else{		$con = mysql_connect(DBHOST,DBUSER,DBPW);	if (!$con)	  {	  die('数据库连接出错: ' . mysql_error());	  }		mysql_select_db(DBNAME, $con);		$result = mysql_query("SELECT uid,password,salt FROM `pre_ucenter_members` where username='".checkstr(user)."'");	mysql_close($con);		$row=mysql_fetch_row($result);	echo("$row[0]|$row[1]|$row[2]");}?>
Copy after login


这个页面执行一次以后,再次执行,修改?user=后面的参数,执行结果没有任何变化。


回复讨论(解决方案)

$user=$_POST["user"];
改为
$user=$_GET["user"];

你不是用POST接收的吗?改?user=后面参数,对POST没有影响啊

谢谢楼上的。代码修正为:

<?phprequire 'Inc/function.php';header("Expires:-1");header("Cache-Control:no-cache");header("Pragma:no-cache");$user=$_GET["user"];if (!isset($user)){	echo("0||");	}else{		$con = mysql_connect(DBHOST,DBUSER,DBPW);	if (!$con)	  {		  die("0||");	  //die('数据库连接出错: ' . mysql_error());	  }		mysql_select_db(DBNAME, $con);		$result = mysql_query("SELECT uid,password,salt FROM `pre_ucenter_members` where username='".checkstr($user)."'");	mysql_close($con);		$row=mysql_fetch_row($result);	echo("$row[0]|$row[1]|$row[2]");}?>
Copy after login


我犯了两个低级错误。除了post改get以外,
checkstr(user)改为checkstr($user)
执行正常了

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template