我很困惑如何通过cgi-bin将POST数据传递给php脚本,我理解它是通过stdin并设置了正确的环境变量。我认为这应该有效吗?
Cat page.php:
<?php
echo $_POST['fname'];
?>
$ echo 'fname=123' | REQUEST_METHOD=POST SCRIPT_FILENAME=page.php REDIRECT_STATUS=CGI CONTENT_LENGTH=10 CONTENT_TYPE=application/www-form-urlencoded php-cgi
Content-type: text/html
<br />
<b>Notice</b>: Undefined index: fname in <b>/home/web/html/page.php</b> on
line <b>2</b><br />