PHP 클래스 think\Hook

파일 보기 프로젝트 열기: top-think/framework 1 사용 예제들

공개 메소드들

메소드 설명
add ( string $tag, mixed $behavior, boolean $first = false ) : void 动态添加行为扩展到某个标签
exec ( mixed $class, string $tag = '', Mixed &$params = null, mixed $extra = null ) : mixed 执行某个行为
get ( string $tag = '' ) : array 获取插件信息
import ( array $tags, boolean $recursive = true ) 批量导入插件
listen ( string $tag, mixed &$params = null, mixed $extra = null, boolean $once = false ) : mixed 监听标签的行为

메소드 상세

add() 공개 정적인 메소드

动态添加行为扩展到某个标签
public static add ( string $tag, mixed $behavior, boolean $first = false ) : void
$tag string 标签名称
$behavior mixed 行为名称
$first boolean 是否放到开头执行
리턴 void

exec() 공개 정적인 메소드

执行某个行为
public static exec ( mixed $class, string $tag = '', Mixed &$params = null, mixed $extra = null ) : mixed
$class mixed 要执行的行为
$tag string 方法名(标签名)
$params Mixed 传人的参数
$extra mixed 额外参数
리턴 mixed

get() 공개 정적인 메소드

获取插件信息
public static get ( string $tag = '' ) : array
$tag string 插件位置 留空获取全部
리턴 array

import() 공개 정적인 메소드

批量导入插件
public static import ( array $tags, boolean $recursive = true )
$tags array 插件信息
$recursive boolean 是否递归合并

listen() 공개 정적인 메소드

监听标签的行为
public static listen ( string $tag, mixed &$params = null, mixed $extra = null, boolean $once = false ) : mixed
$tag string 标签名称
$params mixed 传入参数
$extra mixed 额外参数
$once boolean 只获取一个有效返回值
리턴 mixed