Home > php教程 > php手册 > thinkphp中空模板与空模块的用法实例

thinkphp中空模板与空模块的用法实例

WBOY
Release: 2016-06-06 20:16:43
Original
1463 people have browsed it

这篇文章主要介绍了thinkphp中空模板与空模块的用法,以实例形式演示了空模板与空模块具体实现方法,一般空模块多用于系统找不到指定模块的情况,如定位错误页面与U

本文实例讲述了thinkphp中空模板与空模块的用法。分享给大家供大家参考。具体实现方法如下:

1. 空操作

复制代码 代码如下:

function _empty($name){
            $this-]show("$name 不存在 [a href='__APP__/Index/index']返回首页[/a]");
}


2. 空模块

复制代码 代码如下:

class EmptyAction extends Action{
        function index(){
            $city=M('City');
            $arr=$city-]select();
            $this-]assign('list',$arr);
            $name=MODULE_NAME;//获得当前地址栏的模块名
            $this-]display("City:$name");//引用对应的模块
        }
}

希望本文所述对大家的ThinkPHP框架程序设计有所帮助。

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template