我有一个 HTML 页面,它有两个按钮,我需要在单击按钮时运行 2 个不同的 "sh" 命令,使用 PHP 和 Ajax 我该如何实现?
最佳答案
您可以 ajax request到 php 页面并使用 exec
<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');
?>
关于javascript - 使用 ajax 和 php 执行 Linux shell 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48904517/