drurhg37071 2015-07-27 10:05
浏览 77
已采纳

Laravel 5视图结构

I added a bootstrap template to laravel 5 Resources directory. And added only the index.php to views in Resources.

The index.php file is pointing the files like :

<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

And its not loading.

In my routes.php i am loading :

Route::get('/', function () {
  return view('index');
});
  • 写回答

2条回答 默认 最新

  • duanbei1903 2015-07-27 10:25
    关注

    As I can see in the code, ViewFinder does a case sensitive search for a template based on whatever you provide to the view() helper.

    Pass Index to view() instead of index or change the template name from Index.php to index.php.

    If your view renders correctly, but CSS file is not loaded, it means it's inaccessible to the browser. Files that are not returned via Laravel need to end up somewhere in /public folder so that web server can read them and return to the browser. You need to place them there manually or using some build toos (gulp, grunt, ...).

    In your case, your bootstrap file must end up in public/bootstrap/css/ folder.

    You could also fetch the bootstrap file from a CDN by using one of absolute URLs you can find here: http://www.bootstrapcdn.com/, e.g.:

    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?