我将如何从 PHP 执行 Python 代码?我相信shell_exec(Command)将从终端运行命令。到目前为止我已经试过了:
<?php
$command = escapeshellcmd('python3 main.py');
$output = shell_exec($command);
echo $output;
?>
在 main.py 中,它将返回一个值return randomname,我想将它放在<p>我网站的标签中。
凤凰求蛊
相关分类