doulizhi1247 2013-08-20 14:39
浏览 53
已采纳

无法在codeigniter平台中加载css

I am facing a problem while trying to load css in template/header.php and footer.php and facing problems while doing this.

structure of my codeignitor application is

-application
-views

-- css (folder)
     --- style.css
-- template (folder)
     ---header.php

In header.php I am using the following line to load css

<style> @import url('<?=base_url()?>css/style.css'); </style>

In web console I am seeing it as

GET http://localhost/groce/css/style.css [HTTP/1.1 404 Not Found 1ms]

where groce is name of my application

  • 写回答

2条回答 默认 最新

  • douxie1692 2013-08-20 14:45
    关注

    Try this:

    <link rel="stylesheet" href="<?=site_url('css/style.css');?>" type="text/css"/>
    

    And you need application structure something like this:

    -application
    -css
    -system
    index.php
    .htaccess
    

    Also need add css folder to rewrite condition in .htaccess

    RewriteCond $1 !^(index\.php|css)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请问各位,如何在Jetson nano主控板的Ubuntu系统中安装PyQt5
  • ¥15 MAC安装佳能LBP2900驱动的网盘提取码
  • ¥400 微信停车小程序谁懂的来
  • ¥15 ATAC测序到底用什么peak文件做Diffbind差异分析
  • ¥15 安装ubantu过程中第一个vfat 文件挂载失败
  • ¥20 GZ::CTF如何兼容一些靶机?
  • ¥15 etcd集群部署问题
  • ¥20 谁可以帮我一下问一下各位
  • ¥15 为何重叠加权后love图的SMD与svyCreateTableOne函数绘制基线表的不一致
  • ¥150 求 《小魔指》街机游戏机整合模拟软件