通过';php-l';使用shell_exec

通过';php-l';使用shell_exec,php,Php,我想使用shell_exec('php-l test.php')检查语法; 当我使用像 $rc = shell_exec('php -l test.php'); 它只返回“error parsing test.php”,而不返回错误详细信息。如何读取这些错误详细信息 Thanx提前这些都是为shell_exec、exec等编写的。我建议您开始阅读那些您想要使用的命令的文档。这样你就不用问了。从这里开始:我使用$rc=shell_exec($cmd.2>&1)解决了这个问题;

我想使用
shell_exec('php-l test.php')
检查语法; 当我使用像

$rc = shell_exec('php -l test.php');
它只返回“error parsing test.php”,而不返回错误详细信息。如何读取这些错误详细信息


Thanx提前

这些都是为
shell_exec
exec
等编写的。我建议您开始阅读那些您想要使用的命令的文档。这样你就不用问了。从这里开始:我使用$rc=shell_exec($cmd.2>&1)解决了这个问题;