Yii Learning, Yii
CONFIG
Tableprefix Setting Table prefixes
MODEL
Set the table associated with the model
Public Function TableName () {
return {{%table_name}} table prefix plus table name format
}
Paging: use yii\data\pagination; $Page = new Pagination ([' totalcount ' = total number of bars, ' pageSize ' = number of pages per page]); Query: Must have a modelmodel name corresponding to the database name:: Find ()->where (condition [' status ' =>1]); $tombList
->offset ($Page->offset pagination)
->limit ($Page->limit number of pages)
->all ();->all (); Query all->one (); Query for a->count (); Number of Queries->average (field); Query average->min (field); Query minimum value->max (field); Query maximum value->scalar (); Query the first row of the first column of the value->column (); Query the value of the first column of all results->each (number); Repeatedly query the result, handle memory overflow phenomenon Delete Yii:: $app->db->createcommand ()->delete (' Table name ', ' condition ')->execute (); Modify Yii:: $app->db- >createcommand ()->update (' Table name ', modify field [' Status ' =>1], ' condition ')->execute (); add Yii:: $app->db-> CreateCommand ()->insert (' table name ', data)->execute ();
http://www.bkjia.com/PHPjc/981701.html www.bkjia.com true http://www.bkjia.com/PHPjc/981701.html techarticle Yii Learning, yii CONFIG tableprefix set table prefix model setting table associated with model public function TableName () {return {%table_name}} table prefix plus table name format} Page: Use yii\ ...