Laravel 4 Blade @include variable
问题 I was trying to do include with Laravel blade, but the problem is it can't pass the variable. Here's my example code: file_include.blade.php <?php $myvar = "some text"; main.blade.php @include('file_include') {{$myvar}} When I run the file, it return the error "Undefined variable: myvar". So, how can I pass the variable from the include file to the main file? Thank you. 回答1: Why would you pass it from the include to the calling template? If you need it in the calling template, create it there