解析错误:语法错误,意外'<' laravel刀片模板

时间:2017-11-13 10:22:54

标签: php templates laravel-5 laravel-blade

填写选择列表时出错

 <select name="notificationtype" required class="form-control">
         <option value="sms" {{isset($template->type) ? @if($template->type=='sms' "selected=true" @endif : 'sms'}}> {{ 'SMS'}}</option>
    <option value="email" {{ isset($template->type) ? @if($template->type=='email' "selected=true" @endif : 'email'}}>{{'Email'}}</option> </select>

1 个答案:

答案 0 :(得分:0)

问题出在这一行:

{{isset($template->type) ? @if($template->type=='sms' "selected=true" @endif : 'sms'

尝试这样:

<select name="notificationtype" required class="form-control">
    <option value="sms" @if(isset($template->type) && $template->type=='sms') "selected=true" @endif > SMS </option>
    <option value="email" @if(isset($template->type) && $template->type=='email') "selected=true" @endif > Email </option> 
</select>