在php中从网页生成pdf
如何从服务器即 执行命令 wkhtmltopdf http://google.com /tmp/test.pdf
http://localhost/test.php,当我从命令行执行它时,它可以工作。我尝试了 system() 和 exec() 函数,但没有成功。当我使用 system('touch /tmp/test')
文件时被创建。是什么阻止了 wkhtmltopdf?是php、apache吗?
how can I execute command wkhtmltopdf http://google.com /tmp/test.pdf
from server ie http://localhost/test.php, when I do it from command line it works. I tried system() and exec() functions but did not work. When I use system('touch /tmp/test')
file is created. What stops wkhtmltopdf? Is it php, apache?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保运行脚本的用户知道 wkhtmltopdf bin 的位置。
您可以使用which命令找出它在哪里。
您还可以通过设置等于命令的变量来获取命令的返回状态
例如
Make sure that the user the script is running as knows where wkhtmltopdf bin is.
You can find out where it is with the which command.
Also you can get the return status of a command by setting a variable equal to it
e.g.