【问题标题】:How installing blade template in Microframework Lumen?如何在 Microframework Lumen 中安装刀片模板?
【发布时间】:2016-08-05 11:27:41
【问题描述】:

我有这个版本: 流明 (5.2.6)(Laravel 组件 5.2.*)

【问题讨论】:

    标签: php laravel lumen laravel-blade lumen-5.2


    【解决方案1】:

    默认安装。

    $app->get('/', function () use ($app) {
        return $app->make('view')->make('welcome');
    });
    

    创建一个文件/resources/views/welcome.blade.php 以查看它是否有效。


    更新

    在 Lumen 5.5 中,您可以这样做:

    $router->get('/', function () use ($router) {
        return $router->app->make('view')->make('welcome');
    });
    

    【讨论】:

    • 感谢@Krisan Alfa Timur,但我找到了更好的方法$app->get('/', function () use ($app) { return view('welcome'); });
    • 是的,可以。但是通过$app->make('view') 访问视图比使用view 函数要快一些。
    猜你喜欢
    • 1970-01-01
    • 2016-12-18
    • 2014-03-01
    • 1970-01-01
    • 2013-09-21
    • 2018-09-25
    • 1970-01-01
    • 2013-04-29
    相关资源
    最近更新 更多