I've seen that we can syntax highlight dump()ed variables into templates by installing xdebug.

I installed it on Ubuntu with

$ sudo apt-get install php5-xdebug

Trying to dump an array

{{ dump(my_array) }}

I'm now getting the html markup for the highlighted syntax but escaped in the HTML

<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b> <i>(size=2)</i>
  0 <font color='#888a85'>=></font> 
    <b>array</b> <i>(size=11)</i>

Why is it coming escaped ?

有帮助吗?

解决方案

Because Twig escapes markup by default.

In order to see formatted output, use the raw filter

{{ dump(my_array)|raw }}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top