【发布时间】:2018-08-01 15:44:32
【问题描述】:
我是第一次学习 Laravel,今天才开始。在 LAMPP - Ubuntu 上通过 Composer 安装新的 Laravel。在终端中运行 sudo /opt/lampp lampp start 后,我打开 Chrome 并导航到 localhost/MYAPP/resources/views/welcome.blade.php。 This 是呈现的视图。
"@" 语句(我假设是特定于 Laravel 的控制器)在浏览器中呈现到屏幕上,我无法弄清楚为什么会发生这种情况。
感谢任何/所有见解!
编辑:这里要求的是我的welcome.blade.php 文件:
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>
@endauth
</div>
@endif
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div class="links">
<a href="https://laravel.com/docs">Documentation</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">News</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>
</div>
</div>
</body>
【问题讨论】:
-
你能更新你的代码吗?如果您不发布代码,我们将无法修复。
-
这是一个新安装,我没有添加、更改或删除一行代码。如果有您想要检查的文件,我很乐意发布。但我不知道是哪一个导致了这个问题。
-
我认为你应该发布
layouts/app.blade.php和home.blade.php -
要使用
@auth,laravel 需要 5.5 版本。@else在使用@auth时无效。您可以改用@guest ... @endguest。 -
@Yachi웃 我在项目树的任何地方都没有看到这些文件,也没有看到“布局”目录。是否有可能我没有安装 Blade 或者它没有执行权限?