首先下载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函数
原理:使用curl_init()创建多个请求实例,再使用curl_multi_init()批量执行创建的多个请求实例。文件1:curl.php<?php $threads=500;//并发请求次数 $url='http://blog.cn/index.php?';...
自己的composer已经发布到packagist,但是无法使用composer require easy-task/easy-task来安装,只能在配置文件使用如下方式安装:"require": { "easy...
本教程使用的定时任务基于EasyTak,EasyTask官方文档:https://gitee.com/392223903/EasyTask(1).安装tp5.0或者5.1composer create-project topthink/think=5.0.* tp5&n...
安装php-redis扩展提示No releases available for package我直接去php官网下载redis扩展.tgz文件,然后直接用pecl安装本地文件pecl install ./redis.tgz...
本教程使用的定时任务基于EasyTak实现,EasyTask官方参考文档:https://gitee.com/392223903/EasyTask首先我们必须明白PHP的定时器只能基于CLI命令行形式运行...
场景:模拟验证码发送。仅做代码演示。(1).创建一个验证码发送接口sendCaptcha/** * 发送验证码 */ public function sendCaptcha() { //外部参数(获...