如何将数据从PHP传递到Python?这是我的代码。PHP:
$data = 'hello';
$result = shell_exec('/home/pi/Python.py' .$data);
Python:
result = sys.argv[1]
print(result)
但是当运行python代码时,它会显示错误:
"IndexError: list index out of range"
。
不知道为什么?它是否有其他代码用于将数据从PHP传递到python?
发布于 2016-01-22 18:54:17
应在脚本名称后添加空格
$data = 'hello';
$result = shell_exec('/home/pi/Python.py ' .$data);
https://stackoverflow.com/questions/34944879
复制相似问题