简体   繁体   English

Laravel 视图无法正确渲染

[英]Laravel view not rendering correctly

I am trying to add a new view to my laravel project, and it is just dumping the entire content on the page, including my blade code, instead of executing said code.我正在尝试向我的 Laravel 项目添加一个新视图,它只是将整个内容转储到页面上,包括我的刀片代码,而不是执行所述代码。 For example, my page in the browser is this:比如我在浏览器中的页面是这样的:

@extends('user.layouts.app') @section('title', 'New Reminder') @section('content') New Reminder @csrf Title Content @endsection @extends('user.layouts.app') @section('title', 'New Reminder') @section('content') 新提醒@csrf 标题内容@endsection

When it should obviously be executing that code, not putting it on the page.当它显然应该执行该代码时,而不是将其放在页面上。

I have tried clearing the routes, and researched around but no dice.我试过清理路线,并四处研究,但没有骰子。

I am calling this view the same way I am calling others in my code - in the controller like this:我调用此视图的方式与我在代码中调用其他视图的方式相同 - 在控制器中,如下所示:

return view('user.partials.stat_types.new_type');

Any help or advise is appreciated!任何帮助或建议表示赞赏!

You must have the file name with the extension .blade.php if you want Blade to be used to compile the view.如果您希望使用 Blade 来编译视图,则必须具有扩展名为.blade.php的文件名。 With just .php the PHP engine is used.仅使用.php使用 PHP 引擎。

Change your view filename to have the .blade.php extension.更改您的视图文件名以具有.blade.php扩展名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM