博客
关于我
怎么样写一个自己的渣渣PHP框架(4)
阅读量:220 次
发布时间:2019-02-28

本文共 356 字,大约阅读时间需要 1 分钟。

一口气写这么多,很伤脑啊!哈哈哈!
上我们说到路由和控制器,今天我们说一下具体说一下根据不同的 url 来访问不同控制器的不同方法…

现在加一个控制器的基类,Controller 在/gzy/core下创建一个目录 controller 并且在该目录下创建一个类 Controller.php ,主要放一下公共的方法

在这里插入图片描述
在这之前模仿thinkphp函数的写法在Common/function.php下新增了函数库
在这里插入图片描述

然后你的业务层的控制器,比如你上次建立的文件 IndexController 或者你将来要建立的各种 ArticleController AdminController 等等。

你就可以这样使用,首先继承 Controller,看下图name获取是22

在这里插入图片描述

控制器的基类完成了,然后就可以写view层了…

转载地址:http://sscp.baihongyu.com/

你可能感兴趣的文章
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>