调用url以检索列表


Call an url to retrieve a list

我有个问题。我需要从这个url /wd/biling.php?get&id=1获取数据。我现在这个url返回列表serialize。我尝试使用$data= file_get_contents('/wd/biling.php?get&id=1');进行检索,但出现错误:Failed to open stream。你能帮我吗?

URL只能作为绝对值传递(使用协议+主机+路径)。尝试:

 file_get_contents('http[s]://domain/path');

此外,如果你以这种方式加载任何本地内容,你可能做错了什么。我们使用includerequire来运行本地php文件。你可以用这种方式。

 $id = 1;
 include('/wd/biling.php');

现在,在biling.php中,您可以像那样使用$id。