在网页上执行 python 程序并显示输出

execute the python program on a webpage and display output

我的 raspberry pi 中有 5 个 python 程序。我在 raspberry pi.

安装了 LAMP 服务器

现在我想制作一个网页并执行那些程序。

有没有办法执行它们并在网络浏览器上显示输出?

你可以这样执行:

$command = escapeshellcmd('/usr/custom/test.py');
$output = shell_exec($command);
echo $output;

有进一步的信息Running a python script from PHP

然后您可以制作一个带有执行相关脚本的按钮的简单页面。