Home  >  Article  >  Backend Development  >  thinkphp 一个奇葩的问题

thinkphp 一个奇葩的问题

WBOY
WBOYOriginal
2016-06-06 20:25:171020browse

遇到个很奇葩的问题,

原先的是这样的

<code>$data = compact('id', 'name', 'status', 'add_time');
M('table')->add($data);
</code>

然后我添加保存字段

<code>$data = compact('id', 'name', 'status', 'add_time' 'location', 'article_link');
M('table')->add($data);
</code>

结果问题出来了:我打印$data,location 和 article_link 都有value,但是add后打印的最后sql语句中却没有location他们的值。

求解疑惑?

回复内容:

遇到个很奇葩的问题,

原先的是这样的

<code>$data = compact('id', 'name', 'status', 'add_time');
M('table')->add($data);
</code>

然后我添加保存字段

<code>$data = compact('id', 'name', 'status', 'add_time' 'location', 'article_link');
M('table')->add($data);
</code>

结果问题出来了:我打印$data,location 和 article_link 都有value,但是add后打印的最后sql语句中却没有location他们的值。

求解疑惑?

把~runtime目录删掉试试,TP会缓存数据库表字段,如果在生成缓存的时候还没有location和article_link字段的话,就会忽略掉这两个字段的赋值

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