为什么我不能在这段代码中设置 cookie?在setcookie之前我没有输出或其他任何东西,我只想在数据库中找到后设置用户ID cookie,在设置存储在数据库中的用户和密码后我可以看到1,但我无法设置cookie
<?php
include('db_conector.php');
$InternalUser=$_GET['uid'];
$InternalMD5=$_GET['pid'];
$ActiveLink=$_GET['sended'];
$expire=time()+60*60*24*30;
$InternalUser= mysql_real_escape_string($InternalUser);
$InternalMD5= strtolower(mysql_real_escape_string(($InternalMD5)));
if ($ActiveLink == 'sended'){
$result = mysql_query ("SELECT * FROM userslist WHERE email = '$InternalUser' AND password = '$InternalMD5'");
$count = mysql_num_rows($result);
if($count > 0){
setcookie( "userlogin", "anonymous", $expire, "/" ) ;
echo "<h1 id='CHECK'>1</h1>";
}
else{
echo "<h1 id='CHECK'>0</h1>";
}
}
mysql_close;
?>
也是我的数据库连接器:
<?php
$con = mysql_connect("localhost", "mydb3", "2525")
or die(mysql_error());
mysql_select_db("register", $con)
or die(mysql_error());
?>