首先下载wkhtmltox-0.12.4_linux-generic-amd64.tar.xz (不要下载RPM包,依赖太多,需要x-server支持),并解压,执行测试运行正常
tar wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cd wkhtmltox-0.12.4_linux-generic-amd64/bi
./wkhtmltopdf http://www.gaojiufeng.cn 1.pdf
移动文件夹到规范目录,设置系统环境变
mv wkhtmltox /usr/local //移动文件
vi /etc/profile //编辑配置文件
PATH=/usr/local/wkhtmltox/bin:$PATH export PATH //以上复制文件底部
source /etc/profile //配置文件立即生效
wkhtmltopdf http://www.gaojiufeng.cn 1.pdf
.PHP调用代码
<?php
exec('/usr/local/wkhtmltox/bin/wkhtmltopdf --zoom 1.1 http://www.gaojiufeng.cn 1.pdf',$return);
//exec("wkhtmltopdf http://www.gaojiufeng.cn 2.pdf",$output); //低PHP版本可以用.
if(!$return){
echo 'success';
}
else{
echo 'failed';
}
?> 提示:如果无法执行exec请在php.ini中允许执行exec函数
源码:特别适用于微信支付中通知微信支付网关function array2xml($arr, $level = 1) { $s = $level == 1 ? "<xml&g...
如果想在windows中执行php,并且让php脚本在后台运行,可以用下面的cmd命令start /b php D:\wwwroot\default\demo1\run.php例如上面的命令意思后台运行run.php,如果想用php编写异步代码: ...
<?php /** * @throws Exception */ function curl() { throw new \Exception('err...
posix_ttyname - 获取当前终端设备名称。<?php var_dump( posix_ttyname(STDOUT) );我们启动一个终端,执行上面的代码输出:/dev/tty1我们再启动一个终端,执行上面的代码输...
自己的composer已经发布到packagist,但是无法使用composer require easy-task/easy-task来安装,只能在配置文件使用如下方式安装:"require": { "easy...
第一次听说端口复用是在mixphp最新版本中发现的,mixphp启动监听9501端口,现在作者说可以多开几个进程来执行mixphp,我心里想了下再启动不是会端口冲突嘛,但是却没有问题,于是下载mixphp的源码解读,原来是启动http服务器使用new Co\Http\Server('0.0....