PHP嵌入HTML进行图片选择的问题

时间:2019-01-29 18:01:59

标签: php sql laravel laravel-blade

我似乎无法控制自己想要的动作。如果第一张图片为空,我希望选择适当性别的占位符。

     <div class="image-box">
          <img src="{{config('url.media')}}u/{{ $agent['user_id'] }}/150@2x.jpg" style="width:100%" class="image_main" alt="">
          @if(empty('image_main'))
            @if($agent['gender'] == 'Mr')
              <img src="{{('../assets/male-placeholder.png')}}" style="width:100%" alt="">
            @elseif($agent['gender'] == 'Ms')
              <img src="{{('../assets/female-placeholder.png')}}" style="width:100%" alt="">
            @else($agent['gender'] == 'Mx')
              <img src="{{('../assets/non-binary-placeholder.png')}}" style="width:100%" alt="">
            @endif
          @endif
        </div>

0 个答案:

没有答案