程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了找不到 CSS Codeigniter 4大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决找不到 CSS Codeigniter 4?

开发过程中遇到找不到 CSS Codeigniter 4的问题如何解决?下面主要结合日常开发的经验,给出你关于找不到 CSS Codeigniter 4的解决方法建议,希望对你解决找不到 CSS Codeigniter 4有所启发或帮助;

我在 Codeiginiter 4 中包含的 CSS 有问题。

当我访问此路由 localhost/my_project/user_role 时,所有 CSS 都成功包含。 但是,当我访问此路由 localhost/my_project/user_role/add 时,有 2 个错误是 CSS net::ERR_ABORTED 404(Not Found)

找不到 CSS Codeigniter 4

我查看了网络检查器中的网络选项卡,其中包含 bootstrap.min.CSS 和 app.min.CSS,状态代码为 200,但仍显示未找到错误

找不到 CSS Codeigniter 4

这就是我加载 CSS 文件的方式

找不到 CSS Codeigniter 4

这是我的 htaccess 文件

# disable directory browsing
Options All -Indexes
 
# ----------------------------------------------------------------------
# Rewrite ENGIne
# ----------------------------------------------------------------------
 
# Turning on the rewrite ENGIne is necessary for the following rules and features.
# FollowSymlinks must be enabled for this to work.
<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteENGIne On
 
    # If you installed CodeIgniter in a subfolder,you will need to
    # change the following line to match the subfolder you need.
    # http://httpd.apache.org/docs/current/mod/mod_rewrite.HTML#rewritebase
    # RewriteBase /
 
    # Redirect Trailing Slashes...
    RewriteCond %{requEST_filename} !-d
    RewriteCond %{requEST_URI} (.+)/$
      RewriteRule ^ %1 [L,R=301]
 
    # Rewrite "www.example.com -> example.com"
    RewriteCond %{httpS} !=on
    RewriteCond %{http_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{requEST_URI} [R=301,L]
 
    # checks to see if the user is attempTing to access a valID file,# such as an image or CSS document,if this isn't true it sends the
    # request to the front controller,index.php
    RewriteCond %{requEST_filename} !-f
    RewriteCond %{requEST_filename} !-d
    RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
 
    # Ensure Authorization header is passed along
    RewriteCond %{http:Authorization} .
    RewriteRule .* - [E=http_AUTHORIZATION:%{http:Authorization}]
</IfModule>
 
<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed,all 404's
    # can be sent to index.php,and everything works as normal.
    Errordocument 404 index.php
</IfModule>
 
# disable server signature start
    ServerSignature Off
# disable server signature end

我该如何解决这个问题?请帮忙

解决方法

新 CI4 的结构与以前的版本不同。 现在有一个公共文件夹。我建议您将前端资产放入公共文件夹,这样您的加载就简单得多,而且您不必包含 base_url 即:

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

大佬总结

以上是大佬教程为你收集整理的找不到 CSS Codeigniter 4全部内容,希望文章能够帮你解决找不到 CSS Codeigniter 4所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:4找不到