Home > Backend Development > PHP Tutorial > ThinkPHP empty method display, thinkphp_PHP tutorial

ThinkPHP empty method display, thinkphp_PHP tutorial

WBOY
Release: 2016-07-13 10:23:02
Original
824 people have browsed it

ThinkPHP empty method display, thinkphp

TP If a controller does not have a method, as long as there is a template, the URL will display the template name accordingly.

Example

http://localhost/yiyunmap/map/test

The map controller does not have a test method

But the template file has test.html

The corresponding URL can display the URL

How does thinkphp use no operations and empty methods to solve the 404 problem?

>This doesn’t work. By the way, I don’t have groups. Will it affect the implementation of this function? In addition to creating an EmptyAction empty module, you also need to create an _empty method in each controller. . It's included in every controller. Of course, you can use public classes to avoid such repeated operations. Create a common class controller: CommonAction.class.phpCopy the code and let other controllers inherit it For this controller, something like IndexAction extends CommonAction will do. There seems to be something wrong with the empty method code you posted. header("Location: /404.html"); Your code has been redirected.

All thinkphp pages appear blank

App debug is to turn on or off debugging mode and has little to do with caching. If you want to delete the cache, you can delete all files and folders under the Runtime folder.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/844681.htmlTechArticleThinkPHP empty method is displayed, thinkphp TP If a controller does not have a method, as long as there is a template, the URL will be displayed accordingly Template name. Example http://localhost/yiyunmap/map/t...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template