PHP调用我自己的JSON

PHP调用我自己的JSON,php,json,Php,Json,我的索引文件PHP: Warning: file_get_contents(index.php?z=1) [function.file-get-contents]: failed to open stream: No error in C:\wamp\www\dir\demo.php on line 5 Failed 文件获取内容需要完整的url。不仅仅是文件路径 例如: 文件内容需要一个绝对URL,您使用的是相对URL。如果脚本在同一台服务器上,为什么需要使用file\u get\u内容?解

我的索引文件PHP:

Warning: file_get_contents(index.php?z=1) [function.file-get-contents]: failed to open stream: No error in C:\wamp\www\dir\demo.php on line 5
Failed

文件获取内容需要完整的url。不仅仅是文件路径

例如:


文件内容需要一个绝对URL,您使用的是相对URL。如果脚本在同一台服务器上,为什么需要使用file\u get\u内容?解决方案是删除输出缓冲,只需
require
index.php

另一方面,您将无法对响应进行json_解码,因为您输出了html(pre标记)

Warning: file_get_contents(index.php?z=1) [function.file-get-contents]: failed to open stream: No error in C:\wamp\www\dir\demo.php on line 5
Failed
<?php
    ob_start();
        header("Access-Control-Allow-Origin: *");
        include 'server.php';
        include 'functions.php';
        //SQL and Vars Here
        echo '<pre style="word-wrap: break-word; white-space: pre-wrap;">'.json_encode($array).'</pre>';
ob_flush();
?>
$jsonurl = "http://www.yourwebsiteurl.co.uk/index.php?z=".$pro;