Array ( [xid] => 62da15c424fcb8c3b22510c86d146768 [store_language] => CN [h] => hello ) Warning: Cannot modify header information - headers already sent by (output started at E:\tangtsingyuan\home.php:37) in E:\tangtsingyuan\referer.php on line 61有谁知道这是什么错误?请指教.
使用header和setcookie函数前面是不需有任何输出的。
在程序最前面加上session_start();
PHP是否启用了cookie? 浏览器是否启用了cookie?
foreach (get_defined_vars() as $__key=>$__val) { if (defined('USE_TRUSTED_POST_VARIABLES') && $__key == "trusted_post_variables") continue; if (defined('XCART_INSTALL') && $__key == "module_definition") continue; if (!in_array($__key, array("GLOBALS","HTTP_GET_VARS","HTTP_POST_VARS","HTTP_SERVER_VARS","HTTP_ENV_VARS","HTTP_COOKIE_VARS","HTTP_POST_FILES","__key","__val"))) { unset($$__key); } } 前面就多了这个.如果把上面那个代码放在前面就出现上面的错误提示.如果放到这句后面则什么提示也没有了也不设置cookie了请问为什么呀?
如果我提前先 $_COOKIE['h'] = 'sheet'
这是给$_COOKIE数组加了值,自然可以打印出来了楼主使用的浏览器允许使用cookie吗?
if(isset($_COOKIE['h']) && $_COOKIE['z']=='hello')
print_r($_COOKIE);
else
setcookie('h','hello',time() + 600);楼主测试一下这个
奇怪
可能楼主的PHP.INI配置有问题
Warning: Cannot modify header information - headers already sent by (output started at E:\tangtsingyuan\home.php:37) in E:\tangtsingyuan\referer.php on line 61有谁知道这是什么错误?请指教.
浏览器是否启用了cookie?
if (defined('USE_TRUSTED_POST_VARIABLES') && $__key == "trusted_post_variables") continue; if (defined('XCART_INSTALL') && $__key == "module_definition") continue; if (!in_array($__key, array("GLOBALS","HTTP_GET_VARS","HTTP_POST_VARS","HTTP_SERVER_VARS","HTTP_ENV_VARS","HTTP_COOKIE_VARS","HTTP_POST_FILES","__key","__val"))) {
unset($$__key);
}
}
前面就多了这个.如果把上面那个代码放在前面就出现上面的错误提示.如果放到这句后面则什么提示也没有了也不设置cookie了请问为什么呀?
http://community.csdn.net/Expert/topic/4338/4338855.xml?temp=.4979364