php - 为什么 css 和 bootstrap 没有在 Laravel 5.3 中加载?

标签 php mysql twitter-bootstrap laravel laravel-5.3

这是我的路线文件...


    Route::group(['middleware' => ['auth']], function(){

        Route::get('/profile/{username}', 'ProfileControllers@getProfile');

    });

“ProfileControllers”是这个...


    namespace App\Http\Controllers;
    use DB;
    use App\User;
    use Illuminate\Http\Request;

    class ProfileControllers extends Controller
    {
        public function getProfile($username)
        {
            $user = DB::table('users')->where('username','=', $username)->get();
            return view('web.profile');
        }
    }

这是 View 文件...


    @extends('layout')

    @section('content')
        This is your profile
    @stop

布局文件的头部是这个...


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

当我转到 url "localhost:8000/profile/username" 时,显示了一个没有任何 css 网页的丑陋 html... 当我从路由文件中删除“/{username}”,并将其设为“/profile/username”并转到“localhost:8000/profile/username”(并删除 $username 部分形成 Controller )时,然后是 css 和 Bootstrap 完美加载....

这里发生了什么?

最佳答案

我通过简单地在链接前面加上'/'解决了这个问题

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

关于php - 为什么 css 和 bootstrap 没有在 Laravel 5.3 中加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39944299/

相关文章:

php - 如何修复 Plesk 中的 FastCGI 超时问题?

从 2 列中搜索 php mysql

javascript - 防止 Bootstrap 下拉菜单折叠,直到单击按钮

css - Meteor 更新后字体损坏

html - 是什么导致这两个页面的页脚不同?

php - 使用@时跳过报告错误(错误控制运算符)

php - 存储 PHP 站点设置的好方法是什么?

php - Yii 关系错误尝试获取非对象的属性

mysql - Mysql ASC 如何排序 1,2,3,4,5 而不是 1,10,11,12?

sql - MySQL:哪些索引用于简单范围选择?