PHP 命令行运行不显示错误
2022-08-30 16:24:51
如果我在 Centos 上以“php file.php”的形式运行此程序,它不会显示任何输出,但 php -l 显示它有错误(; 在 EOT 丢失之后)。在这种情况下,如何启用错误报告?
<?php
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
$str = $_POST['name'];
file_put_contents("out.txt",$str);
print <<<EOT
<html><body><h1>You've entered $str</h1></body></html>
EOT
我已经通过:如何在PHP中获得有用的错误消息?