SlimerJs - 安装完成的几个步骤和这个(xvfb-run bin / slimerjs overview.js)linux命令在终端中工作。但是这个命令执行php5 via是行不通的。我试过shell_exec,exec和passthru。所以,请帮帮我。在我的PHP代码下面。
slimer.php
---------------
putenv("SLIMERJS_EXECUTABLE=/opt/slimerjs");
putenv("SLIMERJSLAUNCHER=/usr/bin/xulrunner");
putenv("DISPLAY=:99.0");
$varExec = 'xvfb-run bin/slimerjs overview.js';
shell_exec($varExec);
overview.js
------------
var page = require('webpage').create();
page.open('https://www.google.co.in', function (status) {
page.viewportSize = { width:1024, height:768 };
page.render('screenshot_1.png');
var defaultValue =0;
setTimeout(function() {
page.render('screenshot1.jpg', { format: 'jpg', quality: 90 });
page.close();
slimer.exit()
// Do something after 5 seconds
}, 1000);
});
Above php code run then don't show error.