I'm new to Laravel and trying to replicate the code from this site: Create your first laravel app , but the html tags are echoed as string instead of tags.
The site I'm using uses stuff like these:
<span class="nt"><th></span>
and I dont know what it does. For example, the original @foreach
line was:
@foreach($characters as $key =< $value)
and Laravel was interpreting it as
<?php $__currentLoopData = $characters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>`. i had to change =< to => for the code to run..attached below is the welcome.blade.php code and a screenshot
@if(Auth::check())
<span class="c"><!-- Table --></span>
<span class="nt"><table</span> <span class="na">class=</span><span class="s">"table"</span><span class="nt">></span>
<span class="nt"><tr></span>
<span class="nt"><th></span>Character<span class="nt"></th></span>
<span class="nt"><th></span>Real Name<span class="nt"></th></span>
<span class="nt"></tr></span>
@foreach($characters as $key => $value)
<span class="nt"><tr></span>
<span class="nt"><td></span>{{ $key }}<span class="nt"></td><td></span>{{ $value }}<span class="nt"></td></span>
<span class="nt"></tr></span>
@endforeach
<span class="nt"></table></span>
@endif
<span class="nt"></div></span>
@if(Auth::guest())
<span class="nt"><a</span> <span class="na">href=</span><span class="s">"/login"</span> <span class="na">class=</span><span class="s">"btn btn-info"</span><span class="nt">></span> You need to login to see the list >><span class="nt"></a></span>
@endif
<span class="nt"></div></span>
<span class="nt"></div></span></div>
@endsection.
That doesn't look right. I'm guessing it's a formatting mistake on the auth0 site.
If you have a look at that view template in the repo they provide, it doesn't contain the <
and >
, etc.
The CSS classes such as "nt"
and "c"
are classes that are used to do syntax highlighting on the code in the auth0 post. For example, in the screenshot below you'll see where the "nt"
class was applied to the span
element in which a div
tag was displayed in a part of the code that was rendered correctly.
The <
's and >
's that you see are there to force the browser to render <
and >
, respectively, as text. If instead the characters <
and >
were used themselves, the browser would interpret them as html elements.
In this case, however, there seems to have been a formatting mistake on the part of the code that you posted on the auth0 side before they sent back the html to the browser.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.