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 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据