please help me... I have no idea.
This is part of my php code.
$result;
$resultD;
$arg= $ord." ".$time2_int;
$result=shell_exec('python3 decemberlist.py '.$arg);
$resultD=json_decode($result,true);
echo $resultD['song'];
And This is part of my python code.
import sys
import json
msg=''
def songName(a, b):
global msg
//
return msg
ret=songName(sys.argv[1], sys.argv[2])
rett={'song':ret}
print(rett)
print(json.dumps(rett, ensure_ascii=False))
php code print nothing. How can I solve this problem?
from here , shell_exec
is disabled when PHP is running in safe mode .
but you can try this,
<?php
$result;
$resultD;
$arg= $ord." ".$time2_int;
$command = escapeshellcmd('python3 path/to/python_file/decemberlist.py '.$arg);
$result= shell_exec($command);
$resultD=json_decode($result,true);
echo $resultD['song'];
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.