我想在节点的脚本中多次调用简单的phantomjs函数。我尝试过:
function ph(args){
output='/var/.../'+args[1]+'.jpg';
var page = require('webpage').create();
page.viewportSize = { width: args[2], height: args[3] };
page.zoomFactor = 1;
page.open(args[0], function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
phantom.exit(1);
} else {
window.setTimeout(function () {
page.render(output);
console.log(args[0]);
phantom.exit();
}, 0010);
}
});
}
var args2681 = ['https://url...',2681,600,450];
ph(args2681);
var args2682 = ['https://url...',2682,600,450];
ph(args2682);
但是,只有对函数的最后一次调用才会执行...有任何提示,建议吗?