猿问

如何从php执行shell命令?

我有一个在树莓派上运行的 apache 服务器,我想在 php 中使用命令执行 shell 脚本,

要执行的代码是:

"usr/bin/libreoffice --pt trial1 /var/www/html/Book1.xlsx"

如何运行这个命令?


慕码人2483693
浏览 225回答 2
2回答

DIEA

用于shell_exec()运行 shell 脚本。还要确保在 PHP ini 中启用了 exec 和 shell_exec。

弑天下

在这里使用内置 php 函数的shell_exec()shell_exec("usr/bin/libreoffice --pt trial1 /var/www/html/Book1.xlsx")你也可以在这里使用内置函数exec()或system()见
随时随地看视频慕课网APP
我要回答