Thinkphp5-前置操作
来源:互联网 发布:淘宝红包链接转手机端 编辑:程序博客网 时间:2024/06/08 17:38
<?phpnamespace app\index\controller;use think\Controller;class Index extends Controller{ protected $beforeActionList = [ 'first', //在执行所有方法前都会执行first方法 'second' => ['except'=>'hello'], //除hello方法外的方法执行前都要先执行second方法 'three' => ['only'=>'hello,data'], //在hello/data方法执行前先执行three方法 ]; protected function first() { echo 'first<br/>'; } protected function second() { echo 'second<br/>'; } protected function three() { echo 'three<br/>'; } public function hello() { return 'hello'; } public function data() { return 'data'; }}
如注释所言,为TP5的前置操作。
在以下URL中访问:
http://127.0.0.1/demo/public/index.php/index/index/hello
有如下显示:
first
three
hello
阅读全文
0 0
- Thinkphp5-前置操作
- 关于ThinkPHP5前置操作不生效的问题
- ThinkPHP5数据库操作
- ThinkPHP5常用命令符操作
- thinkphp5 锁表操作
- ThinkPHP5中的事务操作
- thinkphp5中数据库操作
- ThinkPHP5常用数据操作
- thinkphp5的数据库操作
- 前置操作与后置操作
- ThinkPHP5-模型和关联操作
- ThinkPHP5.1 @[模块/控制器/]操作
- ThinkPHP5的验证码操作
- Thinkphp 控制器->前置操作和后置操作
- thinkphp5 之数据操作和模板输出
- ThinkPHP5.0系列之一 console操作
- ThinkPHP5学习(8)数据库-基本操作
- ThinkPHP5学习(9)数据库-事务,链式操作
- JAVA-异常的分类
- 深入理解JVM之七:静态分派与动态分派
- 3. 对象的共享
- HashMap和Hashtable的区别
- [HDU]-6055 Regular polygon
- Thinkphp5-前置操作
- Spring MVC实例-----Controller转注解方式
- 数据类型(ORACLE)
- StringBuffer类——常用方法
- win7下安装postgreSQL教程
- 欢迎使用CSDN-markdown编辑器
- window命令操作
- mysql存储机制
- 解惑 spring 嵌套事务