當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Fave::count方法代碼示例

本文整理匯總了PHP中Fave::count方法的典型用法代碼示例。如果您正苦於以下問題:PHP Fave::count方法的具體用法?PHP Fave::count怎麽用?PHP Fave::count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Fave的用法示例。


在下文中一共展示了Fave::count方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: countExistingFaves

 /**
  * Count the number of faves a notice already has. Used to initalize
  * a tally for a notice.
  *
  * @param integer $noticeID ID of the notice to count faves for
  *
  * @return integer $total total number of time the notice has been favored
  */
 static function countExistingFaves($noticeID)
 {
     $fave = new Fave();
     $fave->notice_id = $noticeID;
     $total = $fave->count();
     return $total;
 }
開發者ID:bashrc,項目名稱:gnusocial-debian,代碼行數:15,代碼來源:Fave_tally.php

示例2: faveCount

 function faveCount()
 {
     $c = Cache::instance();
     if (!empty($c)) {
         $cnt = $c->get(Cache::key('profile:fave_count:' . $this->id));
         if (is_integer($cnt)) {
             return (int) $cnt;
         }
     }
     $faves = new Fave();
     $faves->user_id = $this->id;
     $cnt = (int) $faves->count('notice_id');
     if (!empty($c)) {
         $c->set(Cache::key('profile:fave_count:' . $this->id), $cnt);
     }
     return $cnt;
 }
開發者ID:jianoll,項目名稱:SpeakEnglish_Server,代碼行數:17,代碼來源:Profile.php

示例3: faveCount

 function faveCount()
 {
     $c = common_memcache();
     if (!empty($c)) {
         $cnt = $c->get(common_cache_key('profile:fave_count:' . $this->id));
         if (is_integer($cnt)) {
             return (int) $cnt;
         }
     }
     $faves = new Fave();
     $faves->user_id = $this->id;
     $cnt = (int) $faves->count('distinct notice_id');
     if (!empty($c)) {
         $c->set(common_cache_key('profile:fave_count:' . $this->id), $cnt);
     }
     return $cnt;
 }
開發者ID:microcosmx,項目名稱:experiments,代碼行數:17,代碼來源:Profile.php

示例4: countByProfile

 static function countByProfile(Profile $profile)
 {
     $c = Cache::instance();
     if (!empty($c)) {
         $cnt = $c->get(Cache::key('fave:count_by_profile:' . $profile->id));
         if (is_integer($cnt)) {
             return $cnt;
         }
     }
     $faves = new Fave();
     $faves->user_id = $profile->id;
     $cnt = (int) $faves->count('notice_id');
     if (!empty($c)) {
         $c->set(Cache::key('fave:count_by_profile:' . $profile->id), $cnt);
     }
     return $cnt;
 }
開發者ID:phpsource,項目名稱:gnu-social,代碼行數:17,代碼來源:Fave.php


注:本文中的Fave::count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。