php - 从 PHP 脚本启动 uboost.py 时出错
问题描述
从 PHP 脚本启动 uboost.py 时出现此错误
无法使用 'C:\Users\Administrator\AppData\Local\Programs\Python\Python37 python.exe "C:\uboost\uboost.py" arg1 arg2 创建进程;回声退出状态:$?
我从这个脚本运行它:
<?php
function liveExecuteCommand($cmd)
{
while (@ ob_end_flush()); // end all output buffers if any
$proc = popen("$cmd 2>&1 ; echo Exit status : $?", 'r');
$live_output = "";
$complete_output = "";
while (!feof($proc))
{
$live_output = fread($proc, 4096);
$complete_output = $complete_output . $live_output;
echo "$live_output";
@ flush();
}
pclose($proc);
// get exit status
preg_match('/[0-9]+$/', $complete_output, $matches);
// return exit status and intended output
return array (
'exit_status' => intval($matches[0]),
'output' => str_replace("Exit status : " . $matches[0], '', $complete_output)
);
}
//$output = shell_exec('python C:/uboost/uboost.py pignalice Cazzo1234');
liveExecuteCommand("python C:/uboost/uboost.py pignalice Cazzo1234");
?>
希望有人知道原因 谢谢
解决方案
推荐阅读
- mysql - (不正确的整数值:第 1 行的列 'IdSkjell' 的 '')
- mobile - 如何在 Dart 中锁定屏幕方向
- c# - 保持显示器处于睡眠模式并忽略输入
- java - 如何使用 swing 组件向 JLabel 添加刷新计时器
- c# - C#依赖注入复制
- python - Python Logging:提供来自主模块的日志文件路径
- swift - 在某个点更改动画 UIBezierPath 的颜色
- python - 使用 python 3.x "with open" 函数写入文本文件错误
- javascript - 我无法比较来自 servlet 的 ajax 请求返回的字符串
- gcc - GCC 在适当的目录中为生成的头文件创建依赖项