簡體   English   中英

Laravel 4次觀看

[英]Laravel 4 Views

我是Stack Overflow和laravel的新用戶。

我剛開始在他們的官方網站上學習L4,但現在我在加載視圖方面遇到了一個小問題。

現在我的觀點不正常。 我在視圖dir下調用的任何文件都會導致“文件不存在”錯誤。

這是我的代碼......

作者控制器是:

class AuthorController extends BaseController{

    public $restful = true;

    public function get_index()
    {
    return View::make('authors.index');
    }
}

routes.php我添加了

Route::get('authors',array('uses'=>'authors@index'));

views/authors/index.php

任何HTML文字

更改

Route::get('authors',array('uses'=>'authors@index'));

Route::get('authors',array('uses'=>'AuthorController@get_index'));

如果你不打算做復雜的邏輯,你可以跳過控制器,只需從路由器調用視圖。 並且在你的情況下將函數保持為camelCase也是一個很好的做法getIndex()。

Route::get('authors', 'AuthorController@getIndex');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM