How to get show_error() in CodeIgniter to load a view?

后端 未结 2 1293
离开以前
离开以前 2021-01-21 19:04

I need to load a head view and a foot view in all my pages. But show_error uses its own complete template. And it stops execution after it loads this template, so t

2条回答
  •  后悔当初
    2021-01-21 19:14

    You can create a custom layout to the error messages in the application/errors directory.

    EDIT:

    If you want to use your existing files you can do one of the following:

    1. If you only require the 404 error page, you can set a custom route in config/route.php under $route['404_override'].
    2. If you need to handle all error messages, extend the CI_Exceptions class with MY_Exceptions and using plain PHP, redirect the user to the appropriate page. The exceptions class is loaded before the controller so you cannot use get_instance().

提交回复
热议问题