【发布时间】:2019-04-11 16:46:39
【问题描述】:
我需要将一个多字参数从 PHP 传递到 Python。
只传递一个单词没有问题,但是,如何添加额外的参数才能成功解决?
我尝试了几种方法来传递附加参数,但都没有成功,它会导致 500 Internal Server Error 或 python 脚本没有响应。使用 2>&1 也不会返回任何错误消息。
有六个实例,其中附加参数是可选的或成功响应所必需的。
我可以发送单字参数:
$command = escapeshellcmd("python /home/nova_api.py 'getwithdrawalhistory' 2>&1");
这将返回正确的响应:
{"items":[],"message":"Your trade history with recent first","page":1,"pages":0,"perpage":100,"status":"success","total_items":0}
我尝试将附加参数从 PHP 传递到 Python:
$command = escapeshellcmd("python /home/nova_api.py 'getwithdrawalhistory, { \'page\': 1 }' 2>&1");
$command = escapeshellcmd("python /home/nova_api.py 'getwithdrawalhistory, { \'page\': \'1\' }' 2>&1");
$command = escapeshellcmd("python /home/nova_api.py 'getwithdrawalhistory, { \'page\': \"1\" }' 2>&1");
所有这三个结果都是一个空白页 - 没有响应,也没有返回错误。
【问题讨论】: