PHP Web site of PHP + phantomJS achieve screenshots

php code:

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

js code:

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();
});

The effect is as:

 

Guess you like

Origin www.cnblogs.com/yang-2018/p/11026771.html