Yiiѧϰ(5)----һЩʵÓü¼ÇÉ
À´Ô´£ºÎ´Öª ÔðÈα༣ºÔðÈα༠·¢±íʱ¼ä:2013-12-06 08:43¡¡µã»÷:´Î
Yii¿ò¼ÜÖÐʵÓõļ¼ÇÉ:
p>SQLÓï¾äÖÐÖ÷ÒªÉæ¼°µÄ²Ù×÷ÎÞ·ÇÊÇÔöɾ¸Ä²é.
p>ÎÒÃÇ¿ÉÒÔÔÚmodelsÖж¨Òåscopes·½·¨À´¶¨Òå×î»ù±¾µÄÊý¾Ý²Ù×÷·½·¨:
p>News.php modelÖÐ
p>[php]
p>public function scopes()
p> {
p> return array(
p> //»ñÈ¡ÐÂÎÅͨÓ÷½·¨
p> 'recommend'=>array(
p> 'condition'=>" isrecommend = ".self::RECOMMEND,
p> ),
p> 'getNews'=>array(
p> 'select'=>array('id','title','coverimg'),
p> 'order'=>'dateline DESC',
p> ),
p> );
p> }
p>
p>¶¨ÒåºÃÁËÖ®ºó£¬Èç¹ûҪʹÓÃÀïÃæµÄ·½·¨£¬ÔòÖ»Ðèͨ¹ý:
p>[php]
p>$recommend_news = News::model()->getNews()->recommend()->findAll(array(
p> 'select'=>array('content'),
p> 'condition'=>"coverimg <> '' and coverimg is not null and type = ".News::TYPE_YLZX,
p> 'limit'=>'4',
p> ));
p>µ÷ÓþͿÉÒÔÁË¡£
p>Éæ¼°µ½¸üÐÂÊý¾Ý·½Ãæ:
p>[php]
p>//¸üеã»÷´ÎÊý
p> News::model()->updateCounters(array('clicks'=>1),"id = ".$id);
p>
p>
p>
Ïà¹ØÐÂÎÅ>>
- Cocos2d-xÐéÄâÒ¡¸Ë¿ØÖƾ«ÁéÉÏÏÂ×óÓÒÔ˶¯----Ö®ÓÎÏ·¿ª·¢¡¶ÕÔÔÆÒª
- Cocos2d-x ×Ô¶¨Òå°´Å¥Àà¿ØÖƾ«Áé¹¥»÷----Ö®ÓÎÏ·¿ª·¢¡¶ÕÔÔÆÒª¸ñ¶·
- coco2dѧϰday01 ¾«Áé·ÖÎö
- cocos2d-xѧϰÈÕÖ¾(18) --³ÌÐòÊÇÈçºÎ¿ªÊ¼ÔËÐÐÓë½áÊø?
- cocos2d-x 3.0 rc0 + flappybird ѧϰÐĵÃ
- [cocos2d-x IOSÓÎÏ·¿ª·¢]2014Ä꿪·¢¼°Ñ§Ï°¼Æ»®£ºcocos2d-xÊÓƵר
- Yiiѧϰ(1)----ʹÓ÷½·¨
- Yiiѧϰ(3)----ºËÐÄÓ¦ÓÃ×é¼þ
- Yiiѧϰ(4)----GiiµÄʹÓÃ
- ÄæÏòѧϰ±Ê¼Ç-»ùÓÚEBPµÄÕ»Ö¡
×îÐÂÍƼö¸ü¶à>>>
ÈÈÃÅÐÂÎŽøÈëÒƶ¯¿ª·¢ÆµµÀ>>
- ·¢±íÆÀÂÛ
-
- ×îÐÂÆÀÂÛ ¸ü¶à>>