Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php system()函数无法使用_Php - Fatal编程技术网

php system()函数无法使用

php system()函数无法使用,php,Php,我只是使用文档示例代码进行测试 <?php echo '<pre>'; $last_line = system('ls', $retval); echo ' </pre> <hr />Last line of the output: ' . $last_line . ' <hr />Return value: ' . $retval; ?> 但结果是 我在php.ini的disa

我只是使用文档示例代码进行测试

<?php
    echo '<pre>';
    $last_line = system('ls', $retval);

    echo '
    </pre>
    <hr />Last line of the output: ' . $last_line . '
    <hr />Return value: ' . $retval;
?>

但结果是

我在php.ini的disable_函数中删除了系统。
但是它仍然没有用。

您的代码可能无法工作的主要原因有三个:

  • 代码中存在非法字符。错误很可能被禁用,但PHP正在停止。删除PHP第一行的

  • 如果您在Windows上,
    ls
    不是有效的命令-它仅适用于*nix系统(Linux、Unix/macOS)。您必须将
    ls
    替换为
    dir

  • 最后,如果仍不起作用,则您必须未正确启用
    系统
    。仔细检查
    php.ini
    文件中的
    disable_函数是否未列出
    system
    ,然后重新启动Apache服务器


  • 什么是
    $retval
    ?仅输入错误。