Creating a new page in Laravel

心已入冬 提交于 2020-01-12 14:28:30

问题


I'm trying to create a new page in Laravel and I'm not sure what to do in the context of the Laravel framework. If it was just html, then you just create a new html file. In Laravel, what are all the things you need to do when creating a new page?


回答1:


The easiest way in Laravel is to define a route closure, and return a view from it.

In your routes/web.php file:

Route::get('/my-page', function () {
    return view('my-page');
});

Then in resources/views you create a file called my-page.php, or if you want to use Laravel's Blade syntax (you probably do) call it my-page.blade.php.



来源:https://stackoverflow.com/questions/43221317/creating-a-new-page-in-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!