通过PHP执行命令行? [英] Execute command line via php?
本文介绍了通过PHP执行命令行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何通过php执行这两个命令行:
How I can execute those two command line via php:
wkhtmltopdf www.google.com gg.pdf
wkhtmltopdf www.google.com gg.pdf
&
oofice -headless -nologo -pt cup-pdf my.doc
oofice -headless -nologo -pt cup-pdf my.doc
他们都返回pdf文件并下载到我的主目录中.
they both return a pdf file and download into my home directory.
我想知道通过php从我的html页面执行那些命令的方法.
I want to know the way to execute those command from my html page via php.
谢谢.
推荐答案
您应该看看 手册的系统程序执行 部分:PHP提供了一些可用于启动外部命令/程序的功能,包括:
You should take a look at the System program execution section of the manual : PHP provides several functions that can be used to launch external commands / programs, including :
-
exec()
-可以将命令的输出存储在数组中 -
shell_exec()
-以字符串形式返回命令的输出 -
system()
-会回显命令的输出
exec()
-- which can store the output of the command in an arrayshell_exec()
-- which returns, as a string, the output of the commandsystem()
-- which echoes the output of the command
这篇关于通过PHP执行命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文