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


PHP Zend_Auth::getinstance方法代碼示例

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


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

示例1: logoutAction

 public function logoutAction()
 {
     $auth = Zend_Auth::getinstance();
     $auth->getIdentity();
     if ($auth->hasIdentity() == true) {
         $this->view->code = $auth->getIdentity();
     } else {
         $this->view->code = 'NO';
     }
     $this->forward('login', 'index');
 }
開發者ID:Zziwei,項目名稱:Microknow,代碼行數:11,代碼來源:LoginController.php

示例2: tagAction

 public function tagAction()
 {
     //封裝header
     $tuser = new user();
     $auth = Zend_Auth::getinstance();
     #獲取auth用戶實例
     $auth->getIdentity();
     #取得當前用戶信息
     $email = $auth->getIdentity();
     $tuser = new user();
     $user = $tuser->getAllbyEmail($email);
     $header = array("UID" => $user[0]["UID"], "image" => $user[0]["image"]);
     //封裝tag
     $ttag = new tag();
     $tans = new answer();
     $task = new ask();
     $tquestion = new question();
     $tfollowq = new followQ();
     $tags = $ttag->getAllTags();
     $tagnum = count($tags);
     $this->view->tags = $tags;
     //print_r($tags);
     for ($i = 0; $i < count($tags); $i++) {
         //第i個tag
         $QIDs = $ttag->getQIDsbyTag($tags[$i]);
         $questionnum = count($QIDs);
         $tag[$i]["tag"] = $tags[$i];
         $questiontmp[0] = 0;
         $answernum[0] = 0;
         for ($j = 0; $j < $questionnum; $j++) {
             //第j個question
             $question = $tquestion->getAllbyQID($QIDs[$j]);
             $QID = $QIDs[$j];
             $title = $question["qtitle"];
             if (strlen($title) > 75) {
                 $title = substr($title, 0, 72);
                 $title = $title . "...";
             }
             $follownum = $tfollowq->getFollownumbyQID($QID);
             $answernum[$j] = $tans->getAnswernumbyQID($QID);
             $questiontmp[$j] = array("QID" => $QID, "title" => $title, "follownum" => $follownum, "answernum" => $answernum[$j]);
         }
         array_multisort($answernum, SORT_DESC, $questiontmp);
         for ($j = 0; $j < min(3, count($questiontmp)); $j++) {
             $Qresult[$i][$j] = $questiontmp[$j];
         }
     }
     $this->view->tag = $tags;
     $this->view->Qresult = $Qresult;
     $this->view->header = $header;
     $this->render('tag');
 }
開發者ID:Zziwei,項目名稱:Microknow,代碼行數:52,代碼來源:IndexController.php

示例3: tagAction

 public function tagAction()
 {
     //封裝header
     $auth = Zend_Auth::getinstance();
     #獲取當前用戶實例
     $UID = $auth->getIdentity();
     #取得當前用戶信息
     if ($auth->hasIdentity() == false) {
         $this->render('index');
     }
     $tuser = new user();
     $user = $tuser->getAllbyUID($UID);
     $header = array("UID" => $user["UID"], "image" => $user["image"]);
     //封裝tag
     $ttag = new tag();
     $tans = new answer();
     $task = new ask();
     $tquestion = new question();
     $tfollowq = new followQ();
     $tagnum = $ttag->gerRequest()->getParam("tagnum");
     $tags = $ttag->getAllTags();
     for ($i = 0; $i < $tagnum; $i++) {
         //第i個tag
         $QIDs = $ttag->getQIDsbyTags($tags[$i]);
         for ($j = 0; $j < tagnum; $j++) {
             //第j個question
             $mUID = $task->getUIDbyQID($QIDs[$j]);
             $person = $tuser->getAllbyUID($mUID);
             $image1[$j] = $person['image'];
             $question = $tquestion->getAllbyQID($QIDs[$j]);
             $QID1[$j] = $QIDs[$i];
             $title1[$j] = $question["title"];
             $abstract1[$j] = $question["Qabstract"];
             $follownum[$j] = $tfollowq->getFollownumbyQID($QID1[$j]);
             $answernum[$j] = $tans->getAnswernumbyQID($QID1[$j]);
             $tag1[$j] = $ttag->getTagbyQID($QID1[$j]);
             $time1[$j] = $task->getAskTimebyQID($QIDs[$j]);
             $tag[$i][$j] = array("image" => $image1[$j], "QID" => $QIDs[$j], "title" => $title1[$j], "abstract" => $abstract1[$j], "follownum" => $follownum[$j], "answernum" => $answernum[$j], "tag" => $tag1[$j], "time" => $time1[$j]);
         }
     }
     //傳遞變量,render
     $this->view->tag = $tag;
     $this->view->header = $header;
     $this->render('tag');
 }
開發者ID:Zziwei,項目名稱:Microknow,代碼行數:45,代碼來源:IndexController1.php


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