为什么setcookie不能在实时网站上工作,但它在localhost中工作?

时间:2012-04-05 00:51:25

标签: php codeigniter setcookie

我在

上有一个验证码

captcha link

它使用以下代码:

include 'kcaptcha/kcaptcha.php';
$path = "/";
//this line will produce captcha image
$captcha = new KCAPTCHA();
//writing the cookie so that we can check on next page



//captcha value save as md5 encryption so that when validating is should make md5 mask to captcha form input
setcookie("captcha", md5($captcha->getKeyString()), time()+1000, $path);

此代码适用于localhost,但在我的实时网站上无效。有什么问题?

谢谢

1 个答案:

答案 0 :(得分:1)

在config / config.php的$ config ['cookie_domain']中是否正确输入了域名?