Home > Backend Development > PHP Tutorial > PHP的COOKIE问题

PHP的COOKIE问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:29:16
Original
1273 people have browsed it

在b.example.com/store.php文件里使用CURL访问a.example.php/api.php文件,然后在a.example.php/api.php文件中设置cookie,但是设置失败,请大神解答一下为什么?

回复内容:

在b.example.com/store.php文件里使用CURL访问a.example.php/api.php文件,然后在a.example.php/api.php文件中设置cookie,但是设置失败,请大神解答一下为什么?

应该是curl时没有带上cookie导致

<code>        foreach ($_COOKIE as $k=>$v) {
            $cookie_str[] = $k.'='.$v;
        }
        $ch = curl_init(self::$_authUrl); 
        curl_setopt($ch,CURLOPT_COOKIE, implode('; ', $cookie_str)); //带上cookie</code>
Copy after login
Related labels:
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template