Laravel Blade passing variable with string through @include causes error

后端 未结 3 1536
有刺的猬
有刺的猬 2020-12-13 12:10

In Laravel 5.0.27 I am including a view with with a variable and the following code:

@include(\'layouts.article\', [
        \'mainTitle\' => \"404, page          


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 12:27

    You can pass a $data array

     "404, page not found",
            'mainContent' => "sorry, but the requested page does not exist :("
        ]  ?>
    @include('layouts.article', $data)
    

    use $data['mainTitle'] etc in layouts.article

提交回复
热议问题