Causes and solutions for failure to load css and js files in the php ci framework,
When integrating html pages into the ci framework, loading css and js failed. After half a day, I found that the ci framework is the portal framework,
All requests to files in the framework must be processed by index. php. When loading external css and js files
Use the base_url () function to process external links.
For example:
In the config configuration file, the base_url is: "localhost: 8080/project name /"
Access the application/resource/aaa. js file in the Controller
Access to the relative path <script src = "resource/aaa. js"> </script> fails.
1. output directly in src
<Script src = "<? Php echo base_url ();?>. Resource/aaa. js "> </script>
2. Borrow base tags
Put the base_url () Output in <base href = "<? Php echo base_url ();?> "/> Label, in this way
It is convenient to call on the page.
<Base href = "<? Php echo base_url ();?> "/> <Script src =" resource/aaa. js "> </script>