doujimiao7480 2015-09-07 23:25
浏览 123

Setcookie PHP问题localhost vs普通域名

I was working on my website on localhost (where it worked correctly) and then I moved it to classic domain, but there is issue with PHP setcookie function.

Here is my setcookie sample, basically it will take data from URL paramater called "ID" and then save it as cookie and then it will redirect to website to hide URL paramater.

Yes it works on localhost, but on normal website no..I dont know what to do please help me :)

if (isset($_GET['id'])) {
$hafcookie = $_GET['id'];
setcookie( 'lolcookies', $hafcookie, time() + (10 * 365 * 24 * 60 * 60), COOKIEPATH, COOKIE_DOMAIN );
header( "refresh:0; url=http://mywebsite.com" ); 
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 stm32流水灯+呼吸灯+外部中断按键
    • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
    • ¥15 NX MCD仿真与博途通讯不了啥情况
    • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
    • ¥15 gradio的web端页面格式不对的问题
    • ¥15 求大家看看Nonce如何配置
    • ¥15 Matlab怎么求解含参的二重积分?
    • ¥15 苹果手机突然连不上wifi了?
    • ¥15 cgictest.cgi文件无法访问
    • ¥20 删除和修改功能无法调用