如何在codeigniter应用程序中的文件夹中访问css文件? [英] How to access css file inside a folder in codeigniter application?

查看:172
本文介绍了如何在codeigniter应用程序中的文件夹中访问css文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网页并尝试访问位于application / css /文件夹中的样式表。那么我们如何访问这个文件和什么帮助函数应该使用?下面是我在php文件中使用的头部。

 < head& 
< meta http-equiv =content-typecontent =text / html; charset = utf-8/>
< title>首页< / title>
< link href =css / style.css =stylesheettype =text / cssmedia =screen/>
< / head>如果我使用base_url('css / style.css')或link_tag('css / style。
css'),它返回的URL像 http://localhost/test/css/style.css < a>'不返回css文件的路径。 http:// localhost / test 是基本URL。 / p>

解决方案

这是不推荐,您在应用程序文件夹中有css或图像



在主目录中创建资产文件夹

 应用程序
assets
资产> css
assets>图片
assets> js
system
index.php

在视图上使用示例<?php echo base_url('assets / css / stylesheet.css');?>




I am creating a web page and trying to access a stylesheet which is inside a "application/css/" folder. So how we can access this file and what helper function should use? Below is the head section I used in php file.

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Home</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>

If I use base_url('css/style.css') or link_tag('css/style.css'), it is returning url like 'http://localhost/test/css/style.css' which does not return path of css file.'http://localhost/test' is the base url.

解决方案

It is Not Recommended that you have css or images in applications folder

Create a assets folder in main directory

application
assets
assets > css
assets > images
assets > js
system
index.php

On view use example <?php echo base_url('assets/css/stylesheet.css');?>

Autoload the url helper also.

这篇关于如何在codeigniter应用程序中的文件夹中访问css文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆