<?php
namespace app\index\controller;
class Index
{
public function index()
{
\think\Loader::model('Index')->index();
}
}<?php
namespace app\index\model;
use think\Model;
class Index extends Model
{
public function index()
{
$t = new Test();
$t->type = 11111111;
$t->aaa = 111;
$t->runTest();
}
}<?php
namespace app\index\model;
use think\Model;
class Test extends Model
{
public function runTest()
{
print_r($this->getData());
}
}实际最终只能打印出aaa,type参数无法正确使用Array
(
[aaa] => 111
)究其原因,打印出Test 的 $this 看到对象内是type被处理到了其他位置[autoWriteTimestamp:protected] =>
[createTime:protected] => create_time
[updateTime:protected] => update_time
[dateFormat:protected] => Y-m-d H:i:s
[type:protected] => 11111111
[isUpdate:protected] =>
[replace:protected] => 这个问题如何处理?是不是凡是模型内保留字段都不能用如insert 、update等,这个就比较尴尬了,谁家的数据库里还没有几个type呢?高频词汇吧这是,不应该啊 最佳答案