转自:https://www.jb51.net/article/194017.htm

先修改php的配置文件php.ini,将disable_function里面如下几个函数名删除掉
system, exec, passthru

测试:

<?php
  $shell = "ls -la";
  echo "<pre>";
  system($shell, $status);
  echo "</pre>";
  //注意shell命令的执行结果和执行返回的状态值的对应关系
  $shell = "<font color='red'>$shell</font>";
  if( $status ){
    echo "shell命令{$shell}执行失败";
  } else {
    echo "shell命令{$shell}成功执行";
  }
?>

2020082411444918.png

标签: none

添加新评论