PHP cURL类-Cookie无法运行

PHP cURL类-Cookie无法运行,php,curl,cookies,Php,Curl,Cookies,我用的是从 我已经发送了一些帖子,使用$curl->post(“webiste.com”,array())登录到一个网站从响应返回数据后,我可以验证我是否成功登录 我的问题在于使用$curl->get(“http://website.com"); PHP cURL类的get()函数没有正确读取Cookie 我的代码在文档顶部包含以下内容: $curl = new Curl(); $curl->setCookieFile('cookies.txt'); $curl->setCookie

我用的是从

我已经发送了一些帖子,使用
$curl->post(“webiste.com”,array())登录到一个网站
从响应返回数据后,我可以验证我是否成功登录

我的问题在于使用
$curl->get(“http://website.com");

PHP cURL类的get()函数没有正确读取Cookie

我的代码在文档顶部包含以下内容:

$curl = new Curl();
$curl->setCookieFile('cookies.txt');
$curl->setCookieJar('cookies.txt');
这还不足以让get()函数正确使用cookie吗

我可以验证cookies.txt文件是否已创建,cookies是否已打印在文件中,但它们没有100%被使用

我知道它们没有被正确读取,因为当我使用以下代码时:

echo $curl->get("website.com");

我可以看到我没有登录。

我已经解决了这个问题

所以我补充说

$curl->setCookieFile('cookies.txt');
$curl->setCookieJar('cookies.txt');
在函数内部,我试图使用

$curl->get();
在功能之外。我只在函数中设置了cookiejar和cookiefile,所以在$curl->get()之前;函数,我需要重新声明cookiefile&jar