当类Admin加载默认的index()时调用。 在仪表板视图上加载了css和js,但是当我加载post add_post strong> CSS时,JS和图像没有加载。
i在两个视图文件上放置相同的代码。 仪表板和add_post
这是我的控制器。 p>
p> config.php p> \ n
autoload.php p >
当我加载 index() strong>显示检查元素时的css url。
http://localhost/timesofeducation/css/style.css p>
但是当我加载时。 post() strong>显示检查元素时的css网址。
http:/ /localhost/timesofeducation/Admin/css/style.css p>
管理员 strong>自动添加课程。 p>
div>
class Admin扩展CI_Controller {
公共函数__construct()
\ {
父级:: __ construct() ;
}
公共函数索引()
{
$ this-> load-> view('dashboard');
}
公共函数Post()
\ n $ this-> load-> view('add_post');
}
}
code> pre>
$ config ['base_url'] ='http:// localhost / timesofeducation';
code> pre>
$ autoload ['helper'] = array('url','form','html','captcha','string');
code> pre>
When class Admin loads the by default index() called. the css and js load on dashboard view, but when i load post add_post CSS, JS and image not loading. i put the same code on both view files. dashboard and add_post this is my controller.
class Admin extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view('dashboard');
}
public function Post()
{
$this->load->view('add_post');
}
}
config.php
$config['base_url'] = 'http://localhost/timesofeducation';
autoload.php
$autoload['helper'] = array('url', 'form', 'html', 'captcha', 'string');
when i load index() the css url showing when inspect element. http://localhost/timesofeducation/css/style.css
but when i load. post() the css url showing when inspect element. http://localhost/timesofeducation/Admin/css/style.css
Admin Class automatically added.