I started making the project from scratch and I getting a error and I can't figure out what is it that I'm doing wrong.
I made a directory in the controller folder in which I made a new controller and made a route of it in the routes.php but the thing is I'm getting this error
Not Found
The requested URL /Codeigniter/item was not found on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80
Here is my code
Controller :
/**
* Responsible for controlling all the battleplan task logic and management
*
* @author gardezi
*/
class Item extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index(){
var_dump("HEllo World");
}
}
and here is the route
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['item'] = 'item';
and the MY_Controller Code is :
<?php
/**
* This is the controller responsible for redirecting all the logged out user
* to login page
*
* @author gardezi
*/
class MY_Controller extends CI_Controller{
public function __construct() {
parent::__construct();
}
}
如前所述,您已经在Codeigniter目录的controllers文件夹内创建了子文件夹,并在此处创建了控制器,那么在将控制器路由为时,您必须添加子文件夹名称:
$route['item'] = 'subFolderName/item';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.