tp3.2更新操作时使用field()过滤不需要的字段遇到的坑
M()->table('prefix_student')->field('score',true)->save($data); //不好使,score发生更新,
M('student')->field('score',true)->save($data); //好使score不更新
原因
M()->table()会直接电泳Model.class.php 中的table方法以及后续的连贯操作,不会查询出数据表中的字段信息,所以不会过滤
M(‘表名’)会先调用M()函数,生成模型类连接诶数据库,连接成功后会调用Model.class.php 中的_checkTableInfo()来获得数据字段信息,循环字段信息进行过滤。