Home  >  Article  >  Backend Development  >  ThinkPHP独立分组使用的注意事项_PHP

ThinkPHP独立分组使用的注意事项_PHP

WBOY
WBOYOriginal
2016-05-31 19:27:12703browse

本文实例讲述了ThinkPHP独立分组使用的注意事项。分享给大家供大家参考。具体如下:

关于ThinkPHP的独立分组,功能看上去挺好的,可是官方并没有给出详细的例子和说明,在此,根据实际的开发过程,给予各位php开发人员以下几点说明:

1.独立分组的目录结构

和官方说明一样,建立Modules文件夹,配置config.

代码如下:

import('Action.McorpworkerAction', APP_PATH . 'Modules/base');//自己加载base模块的action 
import('Model.CorpworkerModel', APP_PATH . 'Modules/base'); 
//自己加载base模块的model,不然自动验证等等model中的方法会失效 
$Mworker = new McorpworkerAction();实例化action,注意要写全啊 
$worker["loginname"] =$_REQUEST['loginname']; 
$worker["realname"] =$_REQUEST['realname']; 
$worker["pass"] =mmin($_REQUEST['pass']); 
//构造数据后添加 
$r = $Mworker->addfun($worker); 
//这样才能顺利调用base模块的 Mcorpworker的增删改查!!

希望本文所述对大家的ThinkPHP框架程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn