[英]How can I fix the problem in converting blade syntax to php? if statement in blade to php
I have my code supported by Blade syntax in resources\\views which is working then there is an automated coded from laravel framework in storage\\framework\\views written in PHP. 我的代码在resources \\ views中得到Blade语法的支持,并且可以正常工作,然后在laravel框架中以PHP编写的storage \\ framework \\ views中自动进行了编码。
Blade 刀
PHP PHP
I am expecting to get the same result from blade syntax, but I have a syntax error converting to PHP 我期望从刀片语法中获得相同的结果,但是将语法错误转换为PHP
you're getting an error cause when you use a blade directive, you don't need to use {{ }}
to get a variable value, so the right syntax is: 使用Blade指令时会出现错误原因,不需要使用
{{ }}
来获取变量值,因此正确的语法是:
@if ( Auth::guard("employee")->check() )
...
@endif
one more thing, the check()
method returns a boolean so you can't chain with the user()
method. 还有一件事,
check()
方法返回一个布尔值,因此您不能与user()
方法链接。 so what you need to do is 所以你需要做的是
@if ( Auth::guard("employee")->check() )
<p>welcome {{Auth::user()->name}} !<p>
@endif
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.