2016-08-21 11 views
0

私は新しいlaravelerです。今はlaravelに関する問題を扱っています。私は/を怒り人index.htmlに直接送ります。他はララベルコントローラにルーティングします。しかし、\が順調です。他の人はviewsディレクトリに間違って作業します。
\app\Http\route.phpが好きでは次のとおりです。laravelルートが正しく表示されずに表示される

Route::get('/',function(){ 
    return File::get(public_path().('/views/index.html')); 
}); 

Route::get('scan', "[email protected]"); 
Route::get('check', "[email protected]"); 
Route::get('login', "[email protected]"); 

directyのようなもので、次のとおりです。私はhttp://hostname/scanにアクセスするとき

├── app │ ├── Http │ │ ├── route.php //route file │ ├── Library │ ├── Providers │ ├── Services │ ├── User.php │ └── views
│ │ ├── Index.php // php index file , the entry for nginx server │ └── .......... ├── bootstrap │ ├── app.php │ ├── autoload.php │ └── cache ├── config │ ├── app.php │ └── view.php │ └── .......... ├── public │ ├── bower_components │ ├── css │ ├── data │ ├── index.bak │ ├── index.html //angular index file │ └── scripts │ └── ..........

は、今では404が見つからない、来ます。

などのログは、次のとおり、クライアント: `` ` * 2221年オープン() "/サービス/アンギュラlaravel /アプリ/ビュー/スキャンは、"(そのようなファイルやディレクトリはありません2):失敗XXXX、サーバー:ホスト名、要求: "GET /スキャンHTTP/1.1"、ホスト: "banliyun.com:8081"

`` `

私はどのようにルート仕事で少し混乱があったように。誰かが/ laravelのインデックスページを配置する場所/ディレクトリにルーティングする理由を教えてもらえますか?

答えて

1

/resources/views/index.blade.phpindex.blade.phpとしてごindex.htmlを保存し、次のコードにあなたのルートを変更します。

Route::get('/', function(){ 
    return view('index'); 
}); 
0

AppServiceProviderでクラスブート方法は、線の下に追加します。

View::addLocation(public_path('views')); 

名前の変更index.htmlファイルをindex.blade.phpと入力して、次の行にroute.php

Route::get('/', function(){ 
    return view('index'); 
}); 
関連する問題