Execute command line via php?

后端 未结 2 1553
情歌与酒
情歌与酒 2020-12-17 00:37

How I can execute those two command line via php:

wkhtmltopdf www.google.com gg.pdf

&

oofice -headless -nologo -pt cup-pdf my.doc

they b

相关标签:
2条回答
  • 2020-12-17 01:10

    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() -- which can store the output of the command in an array
    • shell_exec() -- which returns, as a string, the output of the command
    • system() -- which echoes the output of the command
    0 讨论(0)
  • 2020-12-17 01:14

    To create a pdf from php(in linux) you must use a wrapper.

    $cmd = '/usr/bin/xvfb-run --server-args="-screen 0, 1920x1080x24" /usr/bin/wkhtmltopdf http://google.com /tmp/google.pdf';
    
    exec($cmd);
    
    0 讨论(0)
提交回复
热议问题