简体   繁体   English

CSS和Bootstrap在laravel5.8中不起作用。 我怎样才能解决这个问题?

[英]CSS and Bootstrap don't work in laravel5.8. How can I fix this?

I am using laravel 5.8. 我正在使用laravel 5.8。 And I got a huge problem. 我遇到了一个大问题。 CSS and Bootstrap cannot be read. 无法读取CSS和Bootstrap。

1.I did rm storage because I wanted to make php artisan storage:link work. 1.我做了rm storage,因为我想使php artisan storage:link工作。 Finally I couldn't. 最终我不能。

2.After php artisan serve did not work, so I changed to chdir('/'); 2.在php artisan服务无法使用后,我改成chdir('/'); in ServeCommand.php. 在ServeCommand.php中。

3.Also I changed to 3.我也改为

$this->app->bind('path.public', function() {
            return base_path('PATH TO PUBLIC FOLDER');
          });

in AppServiceProvider.php 在AppServiceProvider.php中

4.Now php artisan serve is working but CSS and BootStrap cannot be loaded. 4.现在php artisan服务正在运行,但是无法加载CSS和BootStrap。

This is my index.blade.php (landing page, all links are pasted in this file) 这是我的index.blade.php(登录页面,所有链接均粘贴在此文件中)

<link href="https://fonts.googleapis.com/css?family=Amatic+SC:400,700|Work+Sans:300,400,700" rel="stylesheet">

    <link rel="stylesheet" href="{{asset('external/fonts/icomoon/style.css')}}">

    <link rel="stylesheet" href="{{asset('external/css/bootstrap.min.css')}}">
    <link rel="stylesheet" href="{{asset('external/css/magnific-popup.css')}}">
    <link rel="stylesheet" href="{{asset('external/css/jquery-ui.css')}}">
    <link rel="stylesheet" href="{{asset('external/css/owl.carousel.min.css')}}">
    <link rel="stylesheet" href="{{asset('external/css/owl.theme.default.min.css')}}">
    <link rel="stylesheet" href="{{asset('external/css/bootstrap-datepicker.css')}}">
    <link rel="stylesheet" href="{{asset('external/css/animate.css')}}">

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mediaelement@4.2.7/build/mediaelementplayer.min.css">



    <link rel="stylesheet" href="external/fonts/flaticon/font/flaticon.css">

    <link rel="stylesheet" href="{{asset('external/css/aos.css')}}">

    <link rel="stylesheet" href="{{asset('external/css/style.css')}}">

This is my file structure. 这是我的文件结构。

This is my file structure. 这是我的文件结构。

I created external folder in public folder. 我在公用文件夹中创建了外部文件夹。

If someone knows solution, please help me out. 如果有人知道解决方案,请帮助我。

Here is my console 这是我的控制台

Thank you. 谢谢。

While I don't know what you exactly want to achieve, I am asuming you want to load files from the public/external directory. 虽然我不知道您确切想要实现什么,但我假设您要从public/external目录加载文件。

If you have a clean Laravel 5.8 install {{asset('external/css/bootstrap.min.css') should work out of the box. 如果您有干净的Laravel 5.8安装程序, {{asset('external/css/bootstrap.min.css')应该可以立即使用。 So I should delete the app->bind stuff and try to use 所以我应该删除app->bind东西并尝试使用

{{asset('external/css/bootstrap.min.css')

see: https://laravel.com/docs/5.8/helpers#method-asset 参见: https : //laravel.com/docs/5.8/helpers#method-asset

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM