discuz code

2018-04-02  本文已影响11人  手表大大

discuz 方法

写日志方法

runlog()

SQL 语句 format 的支持

表达式 数据处理
%t DB::table()
%d intval()
%s addslashes
%n in(1,2,3)
%f sprintf('%f',$var)
%i 不做任何处理

方法名:

DB::insert()

参数解释:

例子:

DB::insert('test_db',array('name'=>'张三'),true);

方法名:

DB::delete()

参数解释:

例子:

DB::delete('test_db','id > 5',2);

方法名:

DB::update()

参数解释:

例子:

DB::update('test_db',array('name'=>'lisi'),'id=4');

方法名:

DB::fetch_first()

参数解释:

例子:

DB::fetch_first('SELECT * FROM %t where id > %d', array('test_db',$id) );

方法名:

DB::fetch_all()

参数解释:

例子:

$data = DB::fetch_all('SELECT * FROM %t where id > %d',array('test_db',$id),'id');

方法名:

DB::result_first()

参数解释:

例子:

$data = DB::result_first('SELECT * FROM %t where id > %d',array('test_db',$id));

方法名:

DB::query()

参数解释:

例子:

$data = DB::query('SELECT * FROM %t where id > %d',array('test_db',$id));

方法名:

DB::num_rows()

参数解释:

例子:

$data = DB::num_rows($res);

方法名:

DB::free_result()

参数解释:

例子:

$data = DB::free_result($res);

方法名:

DB:: order()

参数解释:

例子:

$data = DB:: order('id','asc');

方法名:

DB::limit()

参数解释:

例子:

$data = DB::limit('8','5');

方法名:

DB::implode==()==

参数解释:

例子:

$data = DB::implode('8',',');

方法名:

DB::field()

参数解释:

例子:

$data = DB::field('id','5','=');
$data = DB::field('id', array('1','2','3'), 'in');

上一篇 下一篇

猜你喜欢

热点阅读