我在
linux Web服务器上使用以下代码
$error = exec('phantomjs table1.js',$op,$code); echo $code; // prints 11 on screen
table1.js
var page = require('webpage').create(); var url = 'table1.PHP'; page.open(url,function (status) { page.render('ss/table1.png'); phantom.exit(); });
table1.PHP
echo '<h1>This should be converted to an image</h1>';