是否可以制作一个向服务器发送 Linux 命令的 API?
我会寻找看起来像这样的东西
// http://localhost/command=netstat
<?php
$command = $_GET['command'];
// Sends server $command
?>
最佳答案
exec用于执行外部程序。
string exec ( string $command [, array &$output [, int &$return_var ]] )
http://php.net/manual/en/function.exec.php
以下是示例代码;我这样做是为了使用 ffmpeg 在 php 中转换视频。
$a = exec('C:\ffmpeg\bin\ffmpeg.exe -i 56c6ed0e49fe0.qt -strict -2 out22.mp4');
希望这会有所帮助。
关于php - 制作在linux服务器上运行命令的api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42711483/