why phantomjs code doesn't go through array?

廉价感情. 提交于 2019-12-02 06:26:05

page.evaluate() is the sandboxed page context in PhantomJS. It doesn't have access to any variable defined outside. So you cannot reference fs or page inside of it and you don't need to, because page.content is available in the outer context:

page.open(file,function(){
    fs.write(i + '.html', page.content, 'w');
    setTimeout(next_page,100);
});

The remaining code looks fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!