thinkphp 坑多多

controller 名称第二个大写字符必须用下划线代替

 

1.where方法需要在update之前

Db::table('fund')->where(['id' => ['eq', $fund['id']]])->update(['relation_id' => $modelFund->id]);

2.column方法如果只有field参数,默认第一个字段是key,如果有两个字段是key=>value 如果超过两个字段是key=>array; column的field参数如果包含逗号,用数组传递。

3.字符匹配


['exp', "regexp '^[0-9]'"]

4.不可以赋值id更新,只能查询出来的对象才能更新;更新新增方法都是save();


$a = new AttachmentSummary();

5.类大小写问题,php本身不区分类名与函数名称大小写,但是tp框架会把类名大写字母转换为_和字母小写;


$a = new AttachmentSummary();

 

php array_merge 与 +区别

array_merge不保留数字索引,保留字符索引

+号会原样保留

posted @ 2018-09-01 15:29  zgj12306  阅读(151)  评论(1编辑  收藏  举报