【问题标题】:How to set Cookie one host to another host如何将 Cookie 一个主机设置为另一台主机
【发布时间】:2014-10-31 03:36:24
【问题描述】:

我有域 test1.com 来创建到另一个域的 cookie,路径为 example.edu.in

但我尝试了以下方法,但它不起作用

setcookie("user_id",$user_id,0,'/login/','www.example.edu.in');

setcookie("user_id",$user_id,0,'/login/','example.edu.in');

setcookie("user_id",$user_id,0,'/login/','.example.edu.in');

请给我解决方案以访问 example.edu.in 中的此 cookie

【问题讨论】:

  • 发抖的想法....

标签: php session cookies setcookie


【解决方案1】:

这是绝对不可能的。禁止跨域 cookie 访问。

您最接近的方法是在目标域上安装一个脚本,然后让您的脚本将浏览器定向到那里。

【讨论】:

    猜你喜欢
    • 2011-04-14
    • 2015-03-25
    • 2017-04-30
    • 1970-01-01
    • 2016-05-23
    • 2014-12-15
    • 1970-01-01
    • 2016-11-22
    • 1970-01-01
    相关资源
    最近更新 更多