首页 > 其他 > 详细

tp5控制器初始化

时间:2020-05-08 10:17:11      阅读:66      评论:0      收藏:0      [点我收藏+]
namespace app\index\controller;

use think\Controller;

class Index extends Controller
{

    public function _initialize()
    {
        echo ‘init<br/>‘;
    }
    
    public function hello()
    {
        return ‘hello‘;
    }
    
    public function data()
    {
        return ‘data‘;
    }
}

如果访问
http://localhost/index.php/index/Index/hello

会输出

init
hello

如果访问
http://localhost/index.php/index/Index/data

会输出

init
data

tp5控制器初始化

原文:https://www.cnblogs.com/mmore123/p/12848306.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!