setcookie("remuser", $HTTP_POST_VARS['m_username'], time()+86400*30); setcookie("rempass", $HTTP_POST_VARS['m_passwd'], time()+86400*30); 我像上面那样写为什么出错了呢?
Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\app\index.php:19) in c:\apache\htdocs\app\index.php on line 129
Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\app\index.php:19) in c:\apache\htdocs\app\index.php on line 129
解决方案 »
- smarty模板里引入PHP文件
- GET 提交时出现乱码
- 下了个Chart.php 为什么不出图标?
- 如何取会员当前浏览的位置
- 我重装的电脑,现在想编写并运行一下php的hello world,都需要下载什么软件,程序怎么写呢?? 帮帮我
- copy("1.gif","2.gif); 一会成功一会失败是什么原因引起的?
- win2000换2003,如何才能保证数据完好?
- PHP里查MYSQL数据查询很菜的问题就是没有人帮我解决(select 里用IN来查询)
- PHP中form参数传递的问题(急)
- PHP跳转问题
- filesize()函数怎么不管用?
- 求助:提交表单后PHP不能获取提交内容!--在线等!!!!
$username = getValueByCookies("UNAME");
if ( $username == "" )
{
// 没有记录过}读写cookie的代码如下
另:我不建议你直接把密码写在cookie里这样不安全
/**
* 功能: 设置网站登陆后的cookie
* 返回值: 成功返回true, 失败返回false
*/
function setcookies( $username )
{
// expire in half an hour
return setcookie("UNAME", $username, time()+7200, "/", "xxx.com");
}
/**
* 功能: 从cookie中取出指定的值
* 返回值: 成功该值, 失败返回 ""
*/
function getValueByCookies( $cookiename )
{
$value = isset( $_COOKIE[$cookiename] )? $_COOKIE[$cookiename] : "";
return $value;
}
Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\app\index.php:19) in c:\apache\htdocs\app\index.php on line 129
写cookie之前不能用页面的输出