Home >Backend Development >PHP Tutorial >discuz中怎么写操作数据库的句子

discuz中怎么写操作数据库的句子

WBOY
WBOYOriginal
2016-06-13 12:07:00782browse

discuz中如何写操作数据库的句子

本帖最后由 ziluopao3 于 2014-09-25 14:54:50 编辑 比如我想取portal_category这个表中所有字段的值
C::t('portal_category')->fetch........................ 后面怎么写呢?
------解决思路----------------------
C::t('portal_category')->fetch($id);//$id是主键
你可以到/source/class/table/目录下查看所有封装的表模型
你也可以用DB类操作数据库(表模型底层都是用的DB类操作的)
$res=DB::fetch_first('select * from %t where catid=%d',array('portal_category',1));
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