我试图使用 shell_exec 命令从 php 调用 python 文件。但是 shell_exec 没有给出任何输出。
我在终端上运行 python 脚本,它给了我正确的输出
python3 var/www/html/thilina/assets/documents/threadsearch.py keyword,equipment_types/2
这就是我在控制器中调用 python 脚本的方式
$key = $this->input->post('search');//from ajax
$fnum = $this->input->post('sub');//from ajax
$sym = $key.",".$fnum;//search key + 2
$chk = FCPATH."/assets/documents/threadsearch.py";
$chk = str_replace('\\', '/', $chk);
$output = shell_exec("python3 $chk $sym");//get the output from python script
守候你守候我