2

我正在尝试使用PhantomJS,这是我的代码:

<?php
    require '../../../../vendor/autoload.php';

    use JonnyW\PhantomJs\Client;

    $client = Client::getInstance();

    $request  = $client->getMessageFactory()->createRequest();
    $response = $client->getMessageFactory()->createResponse();

    $request->setMethod('GET');
    $request->setUrl('http://google.com');

    $client->send($request, $response);

    var_dump($response);
?>

但它给了我这个错误:

Fatal error: Uncaught exception 'JonnyW\PhantomJs\Exception\ProcedureFailedException' with message 'Error when executing PhantomJs procedure "default" - File does not exist or is not executable: bin/phantomjs' in /var/www/html/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php:132 Stack trace: #0 /var/www/html/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Client.php(170): JonnyW\PhantomJs\Procedure\Procedure->run(Object(JonnyW\PhantomJs\Client), Object(JonnyW\PhantomJs\Message\Request), Object(JonnyW\PhantomJs\Message\Response)) #1 /var/www/html/vendor/jonnyw/php-phantomjs/examples/basic-request.php(15): JonnyW\PhantomJs\Client->send(Object(JonnyW\PhantomJs\Message\Request), Object(JonnyW\PhantomJs\Message\Response)) #2 {main} thrown in /var/www/html/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php on line 132

所以它在这条线上崩溃了:

 $client->send($request, $response);

我尝试 chmod 777 所有的 \vendor 目录和子目录,但没有改变任何东西,你有什么想法吗?

4

1 回答 1

-1

好的,我只需将链接添加到项目根目录中的bin目录即可。

于 2015-10-18T16:47:43.263 回答