THINKPHP5 Note Seven: Set error page ①

Source: Internet
Author: User

Setting the site's error page is also a very important link.

One, empty operation

Adding E_empty operations to the current controller

 Public function _empty () {    $this->error (' method not present ');} Public Function Index () {        }

Test method:



Error: "Method does not exist" will be prompted


Two, empty controller

Create an error controller under the module,

Location: index/error.php Related parameters: Empty_controller


<? PHP /*  */namespace  app\index\controller;use App\index\controller; class Error extends indexbase{    public  function Index () {        '  The controller being accessed does not exist ';    }}

Test: Http://localhost/thinkphp/index/inde3dfx/index

Third, exception error thrown

The ability to affect it is the configuration file under the current module. If the current profile is not valid, the configuration parameters under the public module are automatically locked

Related parameters: Exception_tmpl,error_message

// template file    for exception page ' Exception_tmpl '         ' TPL ' ' THINK_EXCEPTION.TPL ',

THINKPHP5 Note Seven: Set error page ①

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.