`

ThinkPHP3.2.2行为扩展

php 
阅读更多

http://document.thinkphp.cn/manual_3_2.html#behavior_extend

<?php

return array(

    'action_begin'=>array('Home\\Behaviors\\test','Home\\Behaviors\\test1'),//一个标签位可以有多个行为,使用数组即可。

    // 如果是3.2.1版本 则需要改成

    'action_begin'=>array('Home\\Behaviors\\testBehavior','Home\\Behaviors\\test1Behavior')

);

 

其结果是3.2.2还是要按3.2.1这样写

\**********************************************************************************\

<?php

//实例化模型

$User = D('User');

// 相当于 $User = new \Home\Model\UserModel();

// 执行具体的数据操作

$User->select();

当 \Home\Model\UserModel 类不存在的时候,D函数会尝试实例化公共模块下面的 \Common\Model\UserModel 类。

\***********************************************************************************\

 

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics