`php-cgi` 可执行控制台输出 php 版本和 php-cgi 的内容类型
`php-cgi` executable consoles out php version and content type of php-cgi
当我从 OS 命令提示符 运行 我的 php-cgi
可执行文件时,它还会发回内容类型和 PHP 版本作为标准输出包含。但是,在 php.exe 中,这在 Windows 中不可见。
命令:
php-cgi index.php
代码:
<?php
header('Content-Type: application/json');
header('Content-Type: text/html; charset=utf-8');
echo json_encode(array('$_SERVER' => $_SERVER));
?>
PHP-CGI 输出:
X-Powered-By: PHP/8.1.3
Content-Type: text/html; charset=utf-8
{"$_SERVER":{"ALLUSERSPROFILE":"C:\ProgramData","APPDATA"......}
PHP 输出:
{"$_SERVER":{"ALLUSERSPROFILE":"C:\ProgramData","APPDATA"......}
有什么方法可以避免使用 php-cgi 时 powered by 和默认内容类型被屏蔽掉?有设定吗?我在 php.ini
中没有找到任何内容
php-cgi -q index.php
-q Quiet-mode. Suppress HTTP Header output.
抑制“X-Powered-By:PHP/8.1.3”
php-cgi -d expose_php=off index.php
当我从 OS 命令提示符 运行 我的 php-cgi
可执行文件时,它还会发回内容类型和 PHP 版本作为标准输出包含。但是,在 php.exe 中,这在 Windows 中不可见。
命令:
php-cgi index.php
代码:
<?php
header('Content-Type: application/json');
header('Content-Type: text/html; charset=utf-8');
echo json_encode(array('$_SERVER' => $_SERVER));
?>
PHP-CGI 输出:
X-Powered-By: PHP/8.1.3
Content-Type: text/html; charset=utf-8
{"$_SERVER":{"ALLUSERSPROFILE":"C:\ProgramData","APPDATA"......}
PHP 输出:
{"$_SERVER":{"ALLUSERSPROFILE":"C:\ProgramData","APPDATA"......}
有什么方法可以避免使用 php-cgi 时 powered by 和默认内容类型被屏蔽掉?有设定吗?我在 php.ini
中没有找到任何内容php-cgi -q index.php
-q Quiet-mode. Suppress HTTP Header output.
抑制“X-Powered-By:PHP/8.1.3”
php-cgi -d expose_php=off index.php