【问题标题】:print days of a special month ? laravel打印特殊月份的日子?拉拉维尔
【发布时间】:2021-06-04 02:41:05
【问题描述】:

我只需要打印 5 月份的记录

我用变量得到它们

<td>{{ ($registro->created_at->format('d-m-Y')) }}</td>

我只需要查看 5 月的结果,我该怎么做?

【问题讨论】:

    标签: php laravel laravel-5


    【解决方案1】:

    可以使用if条件

     @if($user->created_at->format('M')=="May")
            <td>{{ ($registro->created_at->format('d-m-Y')) }}</td>
        @endif
    

     @if($user->created_at->format('m')=="05")
            <td>{{ ($registro->created_at->format('d-m-Y')) }}</td>
        @endif
    

    【讨论】:

      【解决方案2】:

      只需在 created_at 日期检查 5 月份

      @if($user->created_at->format('m')=="05")
          <td>{{ ($registro->created_at->format('d-m-Y')) }}</td>
      @endif
      

      【讨论】:

        猜你喜欢
        • 2020-01-20
        • 1970-01-01
        • 2017-10-22
        • 1970-01-01
        • 1970-01-01
        • 2017-10-21
        • 2018-08-19
        • 2018-08-26
        • 1970-01-01
        相关资源
        最近更新 更多