doushaizhen1244 2016-02-01 01:33
浏览 116
已采纳

Laravel 5路由到CSS文件夹问题

I have the following route which loads the page but the css of the page doesn't loads.

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

In the contrast the following route loads the same page but here I added index and the page loads correctly. but I also adds index with admins in the browser address bar.

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

I am calling css files in the views like:

<link href="../assets/css/animate.min.css" rel="stylesheet" />

I searched for the solutions but didn't got anything.

  • 写回答

2条回答 默认 最新

  • douwei3172 2016-02-01 01:51
    关注

    For Laravel 4 & 5:

    <link rel="stylesheet" href="{{ URL::asset('assets/css/animate.min.css') }}">
    

    URL::asset will link to your project/public/ folder, so chuck your scripts in there.

    Note: You'll need to be using blade templates to use this. All Blade templates should use the .blade.php extension.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部