我在shell_exe()
函数中运行了这个命令,如下所示:
shell_exec('/usr/bin/soffice --headless --convert-to html:HTML --outdir /home/admin/Desktop/ /home/admin/Desktop/text.docx');
Run Code Online (Sandbox Code Playgroud)
但它在apache错误日志中给出了这样的错误:
错误:请重新验证输入参数...
所以请指导我.
您收到的错误与 PHP/apache 无关。
它是一个soffice
输出。
因此shell_exec()
,即使执行的命令返回了传递回函数的输出,也可以正常工作shell_exec()
。
如何运行soffice
我推荐搜索论坛,例如: https: //ask.libreoffice.org/en/question/2641/convert-to-command-line-parameter/
要接收错误输出,最好使用exec()
函数而不是shell_exec()
https://unix.stackexchange.com/questions/15264/executing-a-shell-command-from-php-with-shell-exec