When the HTML page is integrated into the CI framework, the loading of CSS and JS fails. The reason is that the CI framework is the portal frame
All requests for files in the framework need to be processed by index.php, and when loading external CSS and JS files, the
Use the Base_url () function to handle external links.
You need to load the URL-related class first in the controller
Public Function test () {$this->load->helper (' url '); $this->load->view (' admin/test ');}
In the view view of test.php.
can be used
<link rel= "stylesheet" href= "<?php Echo Base_url ();? >css/min.css "/>
<?php echo Base_url (); The statement outputs the basic pathname.
Need to be declared in configuration file config.php
$config [' Base_url '] = ' http://127.0.0.1/company/';
This will load properly.
Reasons and solutions to the failure of loading CSS and JS files in the PHP CI framework