Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在CodeIgniter中加载多个css、图像和js文件_Css_Codeigniter - Fatal编程技术网

在CodeIgniter中加载多个css、图像和js文件

在CodeIgniter中加载多个css、图像和js文件,css,codeigniter,Css,Codeigniter,我有三个不同的文件夹(css、js、图像)放置在系统、应用程序、用户指南文件夹所在的位置。。现在,我正在尝试将这些文件包括在我的标题_view.php中,如下所示: <link rel="stylesheet" href="<?php echo base_url()?>/css/styles.css" type="text/css" media="screen"> <link rel="stylesheet" href="<?php echo base_ur

我有三个不同的文件夹(css、js、图像)放置在系统、应用程序、用户指南文件夹所在的位置。。现在,我正在尝试将这些文件包括在我的标题_view.php中,如下所示:

<link rel="stylesheet" href="<?php echo base_url()?>/css/styles.css" type="text/css" media="screen">

<link rel="stylesheet" href="<?php echo base_url()?>/css/layout.css" type="text/css" media="screen">
没有任何css样式显示..

有人能帮我吗?非常感谢…

显而易见的答案是查看HTML源代码,并访问CI输出的
href
。它将类似于
http://mysite/com/css/styles.css

访问该URL;如果CSS加载,问题就在别处。如果CSS文件未加载,则它位于错误的目录中

您的
.htaccess
也可能正在重写CSS请求

您的规则可能必须如下所示:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

防止CSS文件被重写。

我会使用类似这样的方法来加载它们

<?php echo link_tag('css/reset.css'); ?>
<?php echo link_tag('css/main.css'); ?>

您的css、媒体文件和js文件应该位于“public_html”下

这首先需要进行基本调试。1.转到浏览器的“查看源”视图2。复制指向样式表3的生成URL。尝试在浏览器中手动打开它们。会发生什么?
<?php echo link_tag('css/reset.css'); ?>
<?php echo link_tag('css/main.css'); ?>
css/styles.css