我有一个运行python脚本的php脚本。我必须将python脚本的输出与php脚本中的特定常量进行比较。 我试着用exec和popen。这是我迄今为止尝试过的代码
$out=NULL;
$pid=exec("python /home/krishna/online/createProblems.py $contest $pcode $fn1 $fn2",$out) or die("error");
if ($out=="1"){echo "Successfully inserted problem";}
使用popen
^{pr2}$两个代码都不能正常工作。。。。 当我测试输出时,我得到“1”作为输出。但与“1”相比是行不通的。在
可以对stdin、stdout和stderr使用管道。在
现在您应该传递执行所需的$cmd。在
相关问题 更多 >
编程相关推荐