IN代码点火器error_404页面设计在hmvc中正常工作,当我使用错误的函数名称,但是当我在hmvc节中使用错误的控制器名称时,它显示空白页面。下面我提到了两种url类型,其中我得到了error_404。 PHP设计。 1)错误页面设计正在处理这种类型的网址
http://localhost/projectName/moduleName/ControllerName/wrongFunctionName2)空白页面显示这种类型的网址
http://localhost/projectName/moduleName/incorrectControllerNameIN code-igniter error_404 page design is working properly in hmvc when i use a wrong function name but when i am using wrong controller name in hmvc section its showing a blank page.below i mention the both url type in which i get the error_404.php design . 1)error page design is working with this type url
http://localhost/projectName/moduleName/ControllerName/wrongFunctionName2)blank page is showing with this type of url
http://localhost/projectName/moduleName/incorrectControllerName最满意答案
以下是我的做法:
在config / routes.php中设置一个404覆盖:
$route['404_override'] = 'utils/page_not_found';创建一个模块utils和一个控制器Page_not_found.php,用于加载404视图或布局。 这只是一个例外。
在你的索引中使用:
public function index() { $this->output->set_status_header('404'); // setting header to 404 // ... more code }Here's how I do it:
Set an 404 override in config/routes.php:
$route['404_override'] = 'utils/page_not_found';Create a module utils and a controller Page_not_found.php that loads your 404 view or layout. It is just an example off course.
In your index use:
public function index() { $this->output->set_status_header('404'); // setting header to 404 // ... more code }更多推荐
发布评论