首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PhantomJS: Twig_Error_Runtime?

PhantomJS: Twig_Error_Runtime?
EN

Stack Overflow用户
提问于 2017-03-04 07:01:32
回答 1查看 56关注 0票数 0

我正在学习php-phantomjs,并且正在获得一个Twig_Error_Runtime。下面是我的PHP:

代码语言:javascript
复制
    $location = '/Applications/myWebApp/js/phantomjsTest.proc';
    $serviceContainer = ServiceContainer::getInstance();

    $procedureLoader = $serviceContainer->get('procedure_loader_factory')
            ->createProcedureLoader($location);
    $client->getProcedureLoader()->addLoader($procedureLoader);

    $request = $client->getMessageFactory()->createRequest();
    $request->setType('phantomjsTest');

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

    if ($response->getStatus() === 200) {
        // Dump the requested page content
        echo $response->getContent();
    }

...and这是我的.proc文件:

代码语言:javascript
复制
phantom.onError = function (msg, trace) {
    console.log(JSON.stringify({
      "status": msg
    }));
    phantom.exit(1);
};

var system = require('system');
var uri = "http://www.jonnyw.me";

var page = require('webpage').create();
page.open(uri, function (status) {
    console.log(JSON.stringify({
      "status": status
    }));

    if (status === "success") {
        page.render('example.png');
    }
    phantom.exit(1);
});

phantom.exit(1);

我遗漏了什么?提前感谢所有人的任何信息。

EN

回答 1

Stack Overflow用户

发布于 2017-03-05 02:02:11

代码语言:javascript
复制
$request->setType('phantomjsTest');

...with此命令:

代码语言:javascript
复制
$client->setProcedure('phantomjsTest');
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42589894

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档