2017-01-01 40 views
0

我有一個節點服務器,我需要從NodeJS服務器調用一些PhantomJS命令。像這個命令一樣。如何從NodeJs服務器調用PhantomJS命令?

phantomjs幻像server.js http://example.com

我對以下問題這個話題了一些答案。但是我不清楚什麼是我必須通過的論據。

Is it possible to run PhantomJS from node.js as a command line argument

在這個例子中有像folloes線。

「其他一些參數(傳遞給phantomjs腳本)」

我無法弄清楚什麼穿過。

+0

請參閱http://stackoverflow.com/a/33992664/2715393 – Vaviloff

+0

除了直接執行Phantomjs進程外,還可以使用服務器模塊直接與服務器進程進行通信http://phantomjs.org/api/webserver /method/listen.html –

回答

0

這意味着在childArgs數組中,除了phantomjs腳本的路徑之外,還可以添加腳本所需的參數。所以,如果你想執行

phantomjs phantom-server.js http://example.com 

你將與你的腳本的路徑沿着傳遞字符串'http://example.com'