刀片模板加载在公共目录中

时间:2014-01-14 13:34:27

标签: php laravel laravel-4 blade

我对laravel完全陌生,刚开始使用它的新应用程序。我正在尝试做一个简单的hello world项目,并且我用.blade.php扩展创建了一个模板,我得到了以下错误

[Tue Jan 14 14:22:50 2014] PHP Fatal error:  require_once(): Failed opening required '/home/ramza/apps/php/testsite/bootstrap/../public/index.blade.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/ramza/apps/php/testsite/server.php on line 19

我的控制器代码在

之下

class GamesController extends BaseController {

    public function index()
    {
            // Show a listing of games.
            return View::make('games.index');
    }
}

我的index.blade.php文件是空的,里面只有hello world,看起来它正试图将它加载到公共目录中。

我试图把这个文件放在公共目录中,它工作得很好

但在app / views / games / index.blade.php中发生错误。任何帮助。感谢。

更新

应用程序/配置/ view.php

<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | View Storage Paths
    |--------------------------------------------------------------------------
    |
    | Most templating systems load templates from disk. Here you may specify
    | an array of paths that should be checked for your views. Of course
    | the usual Laravel view path has already been registered for you.
    |
    */

    'paths' => array(__DIR__.'/../views'),

    /*
    |--------------------------------------------------------------------------
    | Pagination View
    |--------------------------------------------------------------------------
    |
    | This view will be used to render the pagination link output, and can
    | be easily customized here to show any view you like. A clean view
    | compatible with Twitter's Bootstrap is given to you by default.
    |
    */

    'pagination' => 'pagination::slider-3',

);

我的路线档案

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', 'GamesController@index');

1 个答案:

答案 0 :(得分:0)

您确定您的网络服务器是否指向/ public目录作为webroot?