作者:mthj1688 | 来源:互联网 | 2017-05-14 02:20
新建一个test.php{代码...}然后访问test.php,结果报错如下:Warning:file_get_contents(test1.xiaoci.comcreate.php)[function.file-get-contents]:failedtoopenstream:HTTPrequestfailed!H...
新建一个test.php
然后访问test.php,结果报错如下:
Warning: file_get_contents(http://test1.xiaoci.com/create.php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in J:\wamp\www\long\wwwroot\mytools\test\test1.php on line 3
注意:http://test1.xiaoci.com
是我在本地搭建的一个虚拟主机
在本地搭建的一个虚拟主机,配置信息如下:
http-vhost.conf
DocumentRoot "d:/wamp/www/"
ServerName test1.xiaoci.com
hosts
127.0.0.1 test1.com
127.0.0.1 test1.xiaoci.com
并且设置了404返回到index.php,所以当手动从浏览器中打开http://test1.xiaoci.com/create.php
网址的时候,由于create.php是不存在的页面,所以会转到index.php,然后在index.php中进行处理。
手动打开("http://test1.xiaoci.com/create.php")情况:可以正常访问
使用file_get_contents("http://test1.xiaoci.com/create.php")
:报404错误
回复内容:
新建一个test.php
然后访问test.php,结果报错如下:
Warning: file_get_contents(http://test1.xiaoci.com/create.php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in J:\wamp\www\long\wwwroot\mytools\test\test1.php on line 3
注意:http://test1.xiaoci.com
是我在本地搭建的一个虚拟主机
在本地搭建的一个虚拟主机,配置信息如下:
http-vhost.conf
DocumentRoot "d:/wamp/www/"
ServerName test1.xiaoci.com
hosts
127.0.0.1 test1.com
127.0.0.1 test1.xiaoci.com
并且设置了404返回到index.php,所以当手动从浏览器中打开http://test1.xiaoci.com/create.php
网址的时候,由于create.php是不存在的页面,所以会转到index.php,然后在index.php中进行处理。
手动打开("http://test1.xiaoci.com/create.php")情况:可以正常访问
使用file_get_contents("http://test1.xiaoci.com/create.php")
:报404错误
host难道不应该是
127.0.0.1 test1.xiaoci.com
么,我看了下外网的那个网址确实是404,目测是你戳到外网去了,host没兜住