Home> php教程> php手册> body text

LINUX中PHP实现网页截屏实例程序

WBOY
Release: 2016-05-25 16:40:07
Original
1242 people have browsed it

网页截屏以前我们只能在asp.net中实现,下面我来介绍在linux中利用一个插件让php也可以实现网页截屏吧,希望对大家有帮助.

服务器端:为实现截图的程序必须借助服务器端程序,http://code.google.com/p/wkhtmltopdf/

可将网页转换为pdf或者图片,32和64位有区别,找个适合自己服务器的版本.

安装:安装过程十分简单:解压 -> 找个合适的路径放下…

执行:命令行调用1,代码如下:

/servers/app/qtwebkit/wkHtmlToImage phprm.com www.phprm.com.png

默认的清晰度比较高,图片会很大,生成图片需要一定的时间.

php代码如下:

exec('/servers/app/qtwebkit/wkHtmlToImage phprm.com www.phprm.com.png');

具体的使用方法,代码如下:


        
Copy after login

中文乱码问题:主要看服务器是否支持中文语言,如果截图中出现乱码,直接装个中文包就好了,代码如下:

yum install fonts-chinese

文章网址:

随意转载^^但请附上教程地址。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!