FreeABC
记忆重叠

thinkphp 5使用 个人总结

话说 TP5的手册写的真是呵(cao)呵 (dan) 呵!

 

单开一帖,总结一下tp内用到的方法,

 

1、跨模块调用控制器

├─dzcjweb
│ │ .htaccess
│ │ command.php
│ │ common.php
│ │ config.php
│ │ database.php
│ │ develop.php
│ │ localrelease.php
│ │ release.php
│ │ route.php
│ │ tags.php
│ │
│ ├─common
│ │ ├─controller
│ │ │ Commoninit.php
│ │ │
│ │ ├─model
│ │ │ MessageYx.php
│ │ │
│ │ ├─service
│ │ │ NeiMuMessage.php
│ │ │
│ │ └─view
│ │
│ ├─neimu
│ │ │ common.php
│ │ │ config.php
│ │ │ localrelease.php
│ │ │ release.php
│ │ │
│ │ ├─behavior
│ │ ├─controller
│ │ │ Ajax.php
│ │ │
│ │ ├─model
│ │ │ User.php
│ │ │ UserType.php
│ │ │
│ │ └─view
│ │ │ index.html
│ │ │
│ │ ├─login
│ │ │ index.html
│ │ │ login.html
│ │ │
│ │ ├─publicfile
│ │ │ header.html

 

 

例如要在Ajax.php 里面调用  NeiMuMessage.php 的方法,

可以使用助手函数

$NeiMuMessage= controller(‘\[项目目录]\common\service\NeiMuMessage’);

 

数据添加过滤不在表里的字段

$user = new User();
// 过滤post数组中的非数据表字段数据
$user->allowField(true)->save($_POST,['id' => 1]);
未经允许不得转载:Free-Abc智能 » thinkphp 5使用 个人总结
分享到: 更多 (0)