【发布时间】:2019-03-07 06:52:49
【问题描述】:
我是 laravel 的初学者。现在,我想在 localhost 上运行 laravel 项目。现在,我做了什么?我在resource/view/index.blade.php 中创建了index.blade.php 文件,并在routes/web.php 中修改了web.php 文件
路由/web.php
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('index', function () {
return view('index');
});
资源/视图/index.blade.php
<!doctype html>
<html>
<head>
<title>Demo</title>
</head>
<body>
<h1>Laravel start</h1>
</body>
</html>
我已将server.php 更改为index.php 并将.htaccess 文件从public 移动到根目录并重新启动apache 服务器。但它告诉我500 Internal Server Error。我已经运行localhost/laravel,但它不起作用。那么,我该如何解决这个问题呢?请帮帮我。
发生错误
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@dummy-host2.example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/5.6.32 Server at localhost Port 80
谢谢
【问题讨论】:
-
为您的错误提供详细信息,例如:代码行等
-
请看一次@TharakaDilshan
-
为什么要将 server.php 文件更改为 index.php 文件?
-
您可以关注Installation instructions 而不要重命名核心文件。
public应该是您服务器的 DocumentRoot。 -
您可以在浏览器中调用您的路线。所以
http://127.0.0.1:8000/index应该显示您定义的路线。 laravel.com/docs/5.7/routing#basic-routing