日期:2014-05-17  浏览次数:20467 次

用setCookie()时,将域名指定称“localhost”就保存不了Cookie怎么回事??
在本地测试的时候发现的。

这样可以设置Cookie:
PHP code

    setCookie('name[1]', 'yy1', time() + 3600, '/');
    setCookie('name[2]', 'yy2', time() + 3600, '/');



这样就不行了:
PHP code

    setCookie('name[1]', 'yy1', time() + 3600, '/', 'localhost');
    setCookie('name[2]', 'yy2', time() + 3600, '/', 'localhost');



这是为什么?设置称“localhost”不对吗???

谢谢!

------解决方案--------------------
when working on localhost the cookie-domain must be set to "" or NULL or FALSE
------解决方案--------------------
探讨

when working on localhost the cookie-domain must be set to "" or NULL or FALSE