In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to customize the error page of php. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Php custom error page method: 1, add the error page template information in the configuration file; 2, put the configuration information into the / Conf/config.php of the current model; 3, create a Public folder under the View directory of the current model, and customize the error page in it.
This article operating environment: windows10 system, php 7&&thinkphp 5, thinkpad T480 computer.
As a lightweight PHP development framework, ThinkPHP has rich documentation and is easier to use than other frameworks. So we choose thinkphp here to implement a custom error page.
ThinkPHP itself provides us with its own error page, exception page and other information prompt pages, such as the following code:
$this- > error ('CAPTCHA error!')
Because our own pages are not beautiful, we need to customize these pages, and ThinkPHP provides us with the ability to customize prompt pages.
Add the following configuration information to the configuration file:
/ * error page template * / 'TMPL_ACTION_ERROR' = > MODULE_PATH.'View/Public/error.html', / / template file corresponding to default error jump' TMPL_ACTION_SUCCESS' = > MODULE_PATH.'View/Public/success.html', / / template file corresponding to successful jump by default 'TMPL_EXCEPTION_FILE' = > template file for MODULE_PATH.'View/Public/exception.html',// exception page
Put this configuration information into the / Conf/config.php of the current model, then create a Public folder in the View directory of the current model, and customize error.html success.html and exception.html in it.
Here is a simple error page template:
Jump Tip * {padding: 0; margin: 0;} body {background: # 290C0C; font-family: 'Microsoft Yahei'; color: # fff; font-size: 16px;}. System-message {padding: 24px 48px;} .system-message H2 {font-size: 80px; font-weight: normal; line-height: 120px; margin-bottom: 12px}. System-message. System-message .success, .system-message .error {line-height: 1.8em; font-size: 36px} .system-message .detail {font-size: 12px; line-height: 20px; margin-top: 12px; display:none} # wait {font-size:46px;} # btn-stop,#href {display: inline-block; margin-right: 10px; font-size: 16px; line-height: 18px; text-align: center; vertical-align: middle; cursor: pointer Border: 0 none; background-color: # 8B0000; padding: 10px 20px; color: # fff; font-weight: bold; border-color: transparent; text-decoration:none;} # btn-stop:hover,#href:hover {background-color: # ff0000;} prompt!
The page will jump automatically after a second.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.