我有一个网站托管在我的本地服务器 (http://localhost/) 上,它使用 url_rewriting。
当我使用浏览器访问页面时,没问题,它正在加载。
但是当我使用 PHP cUrl 访问相同的 url 时,我得到了 404。
示例:
带有 mod_rewrite 的 URL:http://localhost/site/test
真实页面:http://localhost/site/test.php
从 Firefox加载http://localhost/site/test :工作
使用 cUrl 加载:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/site/test");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
curl_close($ch);
$output -> 来自 apache 的 404 页面
有人知道为什么 cUrl 返回 404 消息吗?