php 执行shell

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 执行shell相关的知识,希望对你有一定的参考价值。

<?php

    $shell "ls -la";
    exec($shell$result$status);
    $shell "<font color=‘red‘>$shell</font>";
    echo "<pre>";
    if$status ){
        echo "shell命令{$shell}执行失败";
    else {
        echo "shell命令{$shell}成功执行, 结果如下<hr>";
        print_r( $result );
    }
    echo "</pre>";
?>

以上是关于php 执行shell的主要内容,如果未能解决你的问题,请参考以下文章