首页 > 解决方案 > 为什么 VSC IDE 不会忽略注释掉的代码?

问题描述

为什么 VSC IDE 不会忽略注释掉的代码?据我了解,对象的对象属性是这样访问的:

$parentobj->$daughterobj.

所以,这应该没问题。我有一个构建表格的索引页。

  @foreach($events as $event)
     <tr>
      <td>{{ $event->id }}</td>
      <td>{{ $event->eventTitle }}</td>
      <td>{{ substr($event->eventDescription, 0, 24)}}</td>
      
      {{-- the IDE trips on the next line, Undefined variable: memory. -->
      
      <td>{{ $event->$memory->id}}</td>
      <td>{{ $event->$memory->memTitle}}</td>
      <td>{{ substr($event->$memory->memBody,0,24)}}</td>```
      **{{-- if I comment them with {{--   --}} it still complains about the Undefined variable: memory**
      
      ```<td>{{ date('Y-m-d', strtotime($event->created_at)) }}</td>
          
      <td>
          <a href="show/{{$event->id}}" class="btn btn-primary">Show</a>
          <a href="event/{{$event->id}}/edit" class="btn btn-primary">Edit</a>
          <form action="/postmem/{{$event->id}}" method="post" class="d-inline">
              {{ csrf_field() }}
              @method('DELETE')
              <button class="btn btn-danger" type="submit">Delete</button>
          </form>
      </td>
  </tr>
@endforeach

有人可以告诉我为什么 IDE 正在读取注释掉的行吗?

标签: phpcomments

解决方案


因为我使用了错误的评论字符。应该的<!-- -->,不是{!-- --}的。坏我。


推荐阅读