英文:
Why View [layouts.main] not found
问题
查看 [layouts.main] 未找到。
为什么即使位置正确,也无法读取?
标题:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>kontol</h1>
<div class="konteng">
@yield('container')
</div>
</body>
</html>
英文:
View [layouts.main] not found.
why is this even though the place is correct why can't it be read?
the Header :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>kontol</h1>
<div class="konteng">
@yield('container')
</div>
</body>
</html>
答案1
得分: 3
您的布局或Blade文件应该位于resources/views
文件夹中。将您的文件从resources/layouts/main.blade.php
移动到resources/views/layouts/main.blade.php
。
然后,我假设您的主页使用beranda.blade.php
,您可以像这样使用布局:
@extends('layouts.main')
@section('container')
{{-- 在这里添加代码 --}}
@endsection
英文:
Your layouts or blade files should be in resources/views
folder. Move your file from resources/layouts/main.blade.php
to resources/views/layouts/main.blade.php
.
Then I assume your homepage using beranda.blade.php
, you can use the layout like this :
@extends('layouts.main')
@section('container')
{{-- code here --}}
@endsection
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论