hywp pwhyml php,php – Twig调试(我没有config.yml)

很久以后我又回到了PHP游戏中.

我正在看Twig,需要了解更多正在发生的事情.我发现了一些需要进入config.yml文件的文本.警告:它不在我的系统上.它是否来自Twig版本或我是否也必须安装Symfony?有点迷失在这里.

干杯.

编辑:我只需要{{dump(var)}}来工作. httpd错误日志告诉我:

PHP致命错误:未捕获异常’Twig_Error_Syntax’,消息’the function“dump”不存在于

我正在设置我的Twig环境:

$twig = new Twig_Environment( $loader, array(

'cache' => '/tmp',

'debug' => true

));

解决方法:

您需要确保使用1.5或更高版本的twig.看起来你只缺少1件将调试扩展添加到你的树枝环境中.

$twig->addExtension(new Twig_Extension_Debug());

以下是转储功能的文档:

The dump function is not available by default. You must add the Twig_Extension_Debug extension explicitly when creating your Twig environment:

$twig = new Twig_Environment($loader, array(

'debug' => true,

// ...

));

$twig->addExtension(new Twig_Extension_Debug());

Even when enabled, the dump function won’t display anything if the debug option on the environment is not enabled (to avoid leaking debug information on a production server).

标签:php,debugging,twig

来源: https://codeday.me/bug/20190825/1713729.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值