【发布时间】:2014-06-20 17:48:50
【问题描述】:
所以我是 laravel 的新手,我正在尝试创建一个非常简单的路线,但似乎无法返回视图。
你可以在下面看到我的路线
Route::get('overview', function()
{
return View::make('overview');
});
当用户导航到 url:http://www.myapp.com/overview 我希望应用返回 overview.php 页面。该应用程序现在只是抛出一个 500 错误。
我的另一条路线运行良好,所以我对到底出了什么问题感到困惑。你可以在下面看到它。
Route::get('/', function()
{
return View::make('index');
});
如果我将概览路径更改为视图索引,它会给我同样的 500 错误。 index.php 和overview.php 都存在于views 文件夹中。
感谢您的帮助。
编辑:显示加载失败的测试页面。名为 test.php 的页面可以在 app/views 中找到 如果我将概览路由更改为 View::make('test') 它也会失败。
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Laravel PHP Framework</title>
<style>
@import url(//fonts.googleapis.com/css?family=Lato:700);
body {
margin:0;
font-family:'Lato', sans-serif;
text-align:center;
color: #999;
}
.welcome {
width: 300px;
height: 200px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -100px;
}
a, a:visited {
text-decoration:none;
}
h1 {
font-size: 32px;
margin: 16px 0 0 0;
}
</style>
</head>
<body>
<div class="welcome">
<a href="http://laravel.com" title="Laravel PHP Framework"></a>
<h1>You have arrived.</h1>
</div>
</body>
</html>
编辑 2:添加了我的 htaccess 文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /falke/
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
【问题讨论】:
-
您是否在视图中使用
blade模板?你的观点的路径是什么,你的观点包含什么? -
我没有在视图中使用任何刀片模板。我的视图的路径是 /app/views 我的视图包含 html 和一些 javascript。
-
显示
Laravel引发错误的视图。 -
检查日志总是一个好主意。 laravel.log 文件可以在 /app/storage/logs 下找到,它可能有助于阐明您面临的问题。你能告诉我们其中的任何信息吗?