我已经在shell_exe()
函数中运行了以下命令:
shell_exec('/usr/bin/soffice --headless --convert-to html:HTML --outdir /home/admin/Desktop/ /home/admin/Desktop/text.docx');
但是它在apache错误日志中给出了以下错误信息:
错误:请重新验证输入参数...
我已经在shell_exe()
函数中运行了以下命令:
shell_exec('/usr/bin/soffice --headless --convert-to html:HTML --outdir /home/admin/Desktop/ /home/admin/Desktop/text.docx');
错误:请重新验证输入参数...
您收到的错误与 PHP / apache 无关。
这是一个 soffice
输出。
因此,shell_exec()
可以正常工作,即使执行的命令返回一个输出,也可以将其传递回 shell_exec()
函数。
如何运行 soffice
,我建议搜索论坛,例如: https://ask.libreoffice.org/en/question/2641/convert-to-command-line-parameter/
为了接收错误输出,最好使用 exec()
函数,而不是 shell_exec()
getting output and exit status from shell_exec()
https://unix.stackexchange.com/questions/15264/executing-a-shell-command-from-php-with-shell-exec
soffice
命令在终端中直接运行良好。 - Jigar Pancholi