LoginSignup
0
0

More than 3 years have passed since last update.

Cannot end a section without first starting one.エラー

Last updated at Posted at 2020-10-15

【概要】

1.結論

2.Cannot end a section without first starting one.とは何か

3.どのように解決するのか

4.開発環境

1.結論

{{--   --}} でコメントアウトする。

2.Cannot end a section without first starting one.とは何か

Google翻訳すると、"最初にセクションを開始せずにセクションを終了することはできません"という意味になります。

3.どのように解決するのか

resorces/views/hoge/index.blade.php
  @section('content') #---❶
      @foreach($data as $item)
      <tr>
        <th>{{$item['name']}}</th>
        <td>{{$item['mail']}}</td>
      </tr>
      @endforeach
    </table>
  @endsection #---❶

  <!--{{-- <p>必要な時だけ記述できます</p> #---❷(1)

   @include('components.message' , ['msg_title'=>'OK'])
        @slot('msg_title')
          タイトル
        @endslot

  @endsection --}}--> #---❷(2)


❶で@section @endsectionをコーディングしていました。そして❷の部分は"command + /"でコメントアウトしていました。しかし、Vscode上のblade.phpでは<!-- -->緑色でコメントアウトになるものの❷(2)がコメントアウト されてないためか、"Cannot end a section without first starting one."というエラーが起きてしまいます。@endsectionが適用されてないことになってしまいました。{!-- --}}だけ囲っても色がついたコメントアウトにならないので<-- {-- --} -->というコーディングにしました。


4.開発環境

Mac catalina 10.15.4
Vscode
PHP 7.4.10
Laravel 8.9.0
Apache 2.4.41

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0