Home > Backend Development > PHP Tutorial > Reasons and solutions for failure to load css and js files in the php ci framework, _PHP tutorial

Reasons and solutions for failure to load css and js files in the php ci framework, _PHP tutorial

WBOY
Release: 2016-07-13 10:21:58
Original
1029 people have browsed it

The reasons and solutions for failure to load css and js files in the php ci framework,

When integrating the html page into the ci framework, loading css and js failed. After a long time, I found that the ci framework is the entrance framework,

All requests for files in the framework need to be processed by index.php. When loading external css and js files,

Use the base_url() function to handle external links.

For example:

The base_url in the config configuration file is: "localhost:8080/project name/"

Access the application/resource/aaa.js file in the controller

Relative pathAccess failed

1. Output directly in src

<script src= "<&#63;php echo base_url();&#63;>.resource/aaa.js"></script>
Copy after login

2. Borrow base tag

Put the output of base_url() inside the

tag

It is more convenient to call it on the page.

<base href = "<&#63;php echo base_url();&#63;>"/>
<script src= "resource/aaa.js"></script>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/852378.htmlTechArticleThe reasons and solutions for failure to load css and js files in the php ci framework, integrating the html page into the ci framework When inside, loading css and js failed. After working for a long time, I found that the ci framework is the entrance frame...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template