gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 07:34:17 25 4
gpt4 key购买 nike

这是我的路线文件...

    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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com