Heim  >  Artikel  >  Backend-Entwicklung  >  ThinkPHP 空方法 显示,thinkphp_PHP教程

ThinkPHP 空方法 显示,thinkphp_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:23:02769Durchsuche

ThinkPHP 空方法 显示,thinkphp

TP如果  一个控制器 没有一个方法 ,只要有一个模版,URL会对应显示模版名称。

 

例子

http://localhost/yiyunmap/map/test

map控制器 并没有 test方法

但是 模版文件有 test.html

URL对应就可以显示 该URL

thinkphp怎用空操作与空方法解决404问题?

>这样子不行.对了我没有分组. 会影响到这个功能的实现吗.你除了 创建一个 EmptyAction 空模块 以外, 还要在每个控制器里面都要建立一个 _empty 方法才行。 每个控制器里面都有。 当然可以用 公用类来避免这样重复的操作。建立一个公用类控制器:CommonAction.class.php复制代码然后 让其他控制器 都继承这个控制器, 如 IndexAction extends CommonAction 这样就行了。你贴出的 empty方法的代码 好像也有点问题。header("Location: /404.html"); 你这段代码 都已经转向了。
 

thinkphp所有页面显示空白

app debug是开启或者关闭调试模式,与缓存没有多大关系。如果你要删除缓存,可以删除Runtime文件夹下面的所有文件和文件夹。
 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/844681.htmlTechArticleThinkPHP 空方法 显示,thinkphp TP如果 一个控制器 没有一个方法 ,只要有一个模版,URL会对应显示模版名称。 例子 http://localhost/yiyunmap/map/t...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn