Home  >  Article  >  php教程  >  php ci框架中加载css和js文件失败的原因及解决方法,

php ci框架中加载css和js文件失败的原因及解决方法,

WBOY
WBOYOriginal
2016-06-13 09:28:06894browse

php ci框架中加载css和js文件失败的原因及解决方法,

在将html页面整合到ci框架里面的时候,加载css和js失败,弄了半天发现ci框架是入口的框架,

对框架中文件的所有请求都需要经过index.php处理完成,当加载外部的css和js文件的时候要使

用base_url()函数处理外部的链接。

比如:

在config配置文件中的base_url为:" localhost:8080/项目名称/ "

在控制器中访问application/resource/aaa.js文件

相对路径访问失败

1、直接在src中输出

2、借用base标签

将base_url()的输出放在"/>标签里面,这样在

页面里面调用比较方便。


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn