【发布时间】:2019-03-30 05:22:53
【问题描述】:
我无法在我的网页上获得一个按钮来执行 python3 脚本,该脚本也与服务器中的其余 html 和 php 文件位于同一文件夹中。
exec();
system();
escapeshellcmd();
shell_exec()
所有这些命令现在都不适合我。我有 chmod +x 我的 .py 文件,并在我的 python 文件的开头包含 #!/usr/bin/env python3 。
<?php
if( isset($_POST['runScript'])){
$command = escapeshellcmd('/nfs/nfs7/home/team51/cgi-
pub/dataProcess.py');
$output = shell_exec($command);
echo $output;
}
?>
<form method="post">
<input type="submit" name="runScript" value="runScript">
</form>
最后,python 脚本应该将一个 csv 文件放在与其余文件相同的文件夹中。但我什么也没得到。
有些函数只是打印回“Array()”
【问题讨论】:
标签: php python html shell unix