星期日, 5月 21, 2017

[Lavarel] 使用View::exists 判斷view blade是否存在

記錄一下為了做樣版切換機制需要用到的View:exists方法 http://stackoverflow.com/questions/32102272/how-to-include-a-blade-template-only-if-it-exists You can use View::exists() to check if a view exists or not. @if(View::exists('path.to.view')) @include('path.to.view') @endif Or you can extend blade and add new directive Blade::directive('includeIfExists', function($view) { });

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails