我需要用php做一个web页面,通过表单传入2个参数,外加一个本地文件到服务器,
<form enctype="multipart/form-data" name="wcg_latency" action="wcg_latency_handle.php" method="post">
<input size="20" type="text" name="p1" value="1.1.1.1:8080" />
<input size="15" type="text" name="p2" value="2.2.2.2" />
<input type="file" name="file" />
<input type="submit" value="Go" id="su" />点击submit提交表单,后台处理上传文件等,然后需要php调用一个外部的python脚本,
$command = $work_dir . "php_exec.py " . $file_dir . " " . $_FILES['files']['name'] . " " . $p1 . " " . $p2;passthru($command, $result);
echo $result;
即调用在work_di目录下的php_exec.py脚本,(带有四个参数),感觉没问题,为什么浏览器一直在submit页面,不跳转,也没result值,在后台看了一下,脚本只执行了一段。绝大部分功能都没实现,这是什么原因,菜鸟求各位大神指点。(红色标记的php调用外部命令的函数pssthru换成system和exec结果一样)
<form enctype="multipart/form-data" name="wcg_latency" action="wcg_latency_handle.php" method="post">
<input size="20" type="text" name="p1" value="1.1.1.1:8080" />
<input size="15" type="text" name="p2" value="2.2.2.2" />
<input type="file" name="file" />
<input type="submit" value="Go" id="su" />点击submit提交表单,后台处理上传文件等,然后需要php调用一个外部的python脚本,
$command = $work_dir . "php_exec.py " . $file_dir . " " . $_FILES['files']['name'] . " " . $p1 . " " . $p2;passthru($command, $result);
echo $result;
即调用在work_di目录下的php_exec.py脚本,(带有四个参数),感觉没问题,为什么浏览器一直在submit页面,不跳转,也没result值,在后台看了一下,脚本只执行了一段。绝大部分功能都没实现,这是什么原因,菜鸟求各位大神指点。(红色标记的php调用外部命令的函数pssthru换成system和exec结果一样)
在控制台上运行一下,看看结果是否正常
首先后台脚本php_exec.py是正确的,php_exec.py里面还调用了另外一个python脚本(pkta.py),pkta.py也没问题。
现在的问题是用php外部调用函数调用php_exec.py时,pkta.py脚本执行了一部分,另外一部分没有执行,也没有报出错。
我现在怀疑是不是用pssthru(或者system, exec)执行的脚本命令不能太复杂呀?