我不知道为什么,但我很难找到如何做到这一点。我想做的只是发布到同一目录中的另一个 .php 文件,然后在浏览器中显示该页面的内容以及发布的数据。
我正在使用它,但我需要访问一个不在 web 根目录中的 php 文件:
$post_data = http_build_query(array('stratus_code' => $this->stratus_code));
$options = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $post_data));
$context = stream_context_create($options);
$result = file_get_contents('http://stratus.sylentec.com/' . $page, false, $context);
echo $result;