Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nikocraft's avatar

how to print curly braces from database

I input this code into tinycme using it's code snippet plugin:

<meta name="csrf-token" content="{{ csrf_token() }}">

it produces code like this:

<pre>
<code class="language-php">&lt;meta name="csrf-token" content="{{ csrf_token() }}"&gt;</code></pre>

that exact code is saved to database In blade template I then print it out using:

{{ htmlentities($post->body) }}

all I get is this:

<pre> <code class="language-php">&lt;meta name="csrf-token" content=""&gt;</code></pre> <p>&nbsp;</p>

Where did the curly braces go?

0 likes
9 replies
tisuchi's avatar

If it is saved in DB properly, then you can give a try without htmlentites().

{{ $post->body }}
nikocraft's avatar

@tisuchi @jekinney it's not working guys I allready tried. I did this test in My Controller just to test if php can print double curly brackets:

        echo 'test {{ test }}';
        dd();

'test {{ test }}' gets printed out. Now I removed dd(); and only 'test test' gets printed out and no curly brackets. It seems that Laravel is removing the {{ }} Does anyone know why?

nikocraft's avatar

@marvanni I can confirm that it was vue that messed this up. Removing Vue it's working now.

Siemen's avatar

I've the same issue but removing VueJS is not an option for me since I want to use VueJS in my application.

Is there a solution for this issue?

Siemen's avatar
Siemen
Best Answer
Level 1

I've fixed it by adding v-pre. Like this: <span v-pre>{{ $post->body }}</span> When you use this you're still able to use the VueJS framework.

1 like
nikocraft's avatar

thats great! thanks for update :) we all use vuejs now in our projects and I will soon need this again, so its just purefect! :)

Please or to participate in this conversation.