Home >Backend Development >PHP Tutorial > cookie为啥设置失败

cookie为啥设置失败

WBOY
WBOYOriginal
2016-06-13 12:44:581297browse

cookie为什么设置失败?
我有这样一段程序:
if(setcookie('me','mycookie'))
{
echo "cookie已设置";
}
echo "已登录";

运行结果是"已登录”是有的,但"cookie已设置“没有显示。这说明cookie设置失败了。

请问我这一段程序为什么会设置失败呢?有语法错误吗?失败的原因可能是什么?(我的浏览器支持cookie)

Statement:
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