PHP 之PHP + phantomJS实现网站截屏

php代码:

exec("G:/phpstudy/WWW/destoon/api/a/cache/web/phantomjs.exe ./get.js http://www.baidu.com ./img/example.png");

js代码:

var page = require('webpage').create(), system = require('system');
var url = system.args[1], file_name = system.args[2];
page.open(url, function () {
    page.render(file_name);
    phantom.exit();
});

效果如图:

猜你喜欢

转载自www.cnblogs.com/yang-2018/p/11026771.html
php