我把所有的参数写后通过跳转到别的接口网站,别的接口网站会返回一个值给我,我再把这个值写到cookies中,
现在我跳转过去了,但是我不知道怎样写到我的cookies中,能写吗?我的思路有问题吗?请同行帮忙
$key =base64_encode('xxxx.com');
$url='xxx.com?id=1&name=2';
setcookie($key, $result,time()+3600, "/", ".xxxx.com",1);
echo "<meta http-equiv=refresh content='0; url=$url'>";
.......

解决方案 »

  1.   

    我说一下我的思路
    接口返回值 = 接口函数(你的参数)
    setcookie(string name [, 接口返回值  [, int expire [, string path [, string domain [, bool secure]]]]] );
      

  2.   

    PHP手册上的例子:
    <?php
    $value = 'something from somewhere';setcookie("TestCookie", $value);
    setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
    setcookie("TestCookie", $value, time()+3600, "/~rasmus/", ".example.com", 1);
    ?>
      

  3.   

    我是说跳转后到别的网站给我网站返回一个值,我能写入cookies吗
      

  4.   


    当然可以,,,给的返回值,你怎么接收的?就在该文件里设置cookie
      

  5.   

    The value of the cookie. This value is stored on the clients computer; do not store sensitive information. Assuming the name is 'cookiename', this value is retrieved through $_COOKIE['cookiename']
      

  6.   

    对方怎么返回的你就怎么接收。
    GET/POST/或其他。没测试过在a.com
    setcookie($key, $result,time()+3600, "/", ".b.com",1);
    这样b.com是否可以接收到cookie.
    如果你存这个cookie,在b.com不会用到,就不要这样存。
    如果要用到,在跳转到对方望站的时候,对方就可以直接存,因为是跳转的