About the use of thinkphp behavior
Jul 07, 2018 pm 02:39 PM这篇文章主要介绍了关于thinkphp行为的使用,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
行为说简单一点就是程序执行到某一步会自动调用的一段操作,示例如下
第一步、添加行为标签位
$param['ids'] = $ids; Hook::listen('event_reject',$param);
参数$param可选
第二步、行为绑定
在项目目录APP_PATH下的tags.php文件中进行绑定
return [ 'event_stop_publish'=>['app\\qikan\\behavior\\StopPublish']];
第三步、在绑定的行为位置进行行为定义
namespace app\index\behavior;class Test { public function app_init(&$param) { //$params 为引用传递 } public function app_end(&$param) { } }
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:
WordPress 之在注册界面 实现 注册后密码直接显示在页面上
The above is the detailed content of About the use of thinkphp behavior. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

Build a React App With a Laravel Back End: Part 2, React

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon
