Php 通过文件发送post数据\u获取内容,post数据是否可由客户端/浏览器读取?

Php 通过文件发送post数据\u获取内容,post数据是否可由客户端/浏览器读取?,php,post,file-get-contents,Php,Post,File Get Contents,如果我使用file_get_contents将post数据发送到另一个.php,就像下面手册中给出的示例一样,那么这个网页的访问者是否有可能查看/跟踪我发送的post数据?谢谢 <?php $postdata = http_build_query( array( 'var1' => 'some content', 'var2' => 'doh' ) ); $opts = array('http' => array

如果我使用file_get_contents将post数据发送到另一个.php,就像下面手册中给出的示例一样,那么这个网页的访问者是否有可能查看/跟踪我发送的post数据?谢谢

<?php

$postdata = http_build_query(
    array(
        'var1' => 'some content',
        'var2' => 'doh'
    )
);

$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);

$context = stream_context_create($opts);

$result = file_get_contents('http://example.com/submit.php', false, $context);

?>


简单的答案是否定的,因为它发生在服务器端,访问者无法访问它。欢迎@murphy118。你是说,他们可以查看原始文件位置吗?如果是这样的话,那么就没有了。PHP在服务器上运行,然后在处理后将输出传递给客户机。客户端看不到服务器路径(除非服务器因为错误而输出原始php代码)。谢谢你们两个,是的,出于安全原因,我考虑过这个问题。在另一个脚本中,其中一些值触发SQL语句,这就是原因。