我有一个执行php脚本的python脚本,但我希望传递变量:
我的python:
cmd = ["php /mypath/myphp.php"]
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
我的php:
$param1=$_POST['param1'];
$param2=$_POST['param2'];
请问我如何实际传递参数?
答案 0 :(得分:0)
您应该在Python中使用<%= f.email_field :email, autofocus: true, autocomplete: "email", class:"form-control" %>
,在PHP中使用popen
$argv[]
import os
value1 = 'test'
value2 = 'test2'
cmd = rf'php /mypath/myphp.php {value1} {value2}'
os.popen(cmd)