laravel Lumen 5.2+ 中的视图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39812407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:32:41  来源:igfitidea点击:

Views in Lumen 5.2+

laravellumenlumen-5.3laravel-views

提问by Miguel Borges

I need to build a small widget, and was planning to use the Lumen for this because I need a quick response and I need components such as routing, translation, requests and views. the problem is noticed now that the views were discontinued after version 5.1.

我需要构建一个小部件,并计划为此使用 Lumen,因为我需要快速响应,并且需要诸如路由、翻译、请求和视图之类的组件。现在注意到这个问题,在 5.1 版之后这些视图停止了。

Is it possible to use views in more recent versions of Lumen?

是否可以在更新版本的 Lumen 中使用视图?

回答by patricus

While Lumen 5.2.0 originally stripped out views, they were added back in in Lumen 5.2.1, and have been available since. You should be able to use views without an issue.

虽然 Lumen 5.2.0 最初删除了视图,但它们在 Lumen 5.2.1 中重新添加,并从那时起可用。您应该能够毫无问题地使用视图。

resources/views/test.blade.php:

资源/视图/test.blade.php

Hello, world!

routes.php:

路线.php:

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