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


PHP Visitor::save方法代碼示例

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


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

示例1: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $visitor = new Visitor();
     $visitor->ip_address = $this->getRealIp();
     if ($visitor->save()) {
         $this->render('index');
     }
 }
開發者ID:djeyakumar,項目名稱:aircpit,代碼行數:14,代碼來源:SiteController.php

示例2: create

 public static function create($name, $location, $message, $tinyUrl = null)
 {
     $visitor = new Visitor(null);
     $visitor->setName($name);
     $visitor->setLocation($location);
     $visitor->setMessage($message);
     $visitor->setTinyUrl($tinyUrl);
     $visitor->setGeneratedId($visitor->generateId());
     $visitor->setId($visitor->save());
     return $visitor;
 }
開發者ID:jsanders,項目名稱:php_api_playground,代碼行數:11,代碼來源:visitor.php

示例3: postRegister

 public function postRegister(Request $request)
 {
     //驗證
     $this->validate($request, ['username' => 'required|max:255|unique:visitors', 'password' => 'required|min:6', 'email' => 'required|email|max:255|unique:visitors']);
     $visitor = new Visitor();
     $visitor->username = $request->input('username');
     $visitor->password = bcrypt($request->input('password'));
     $visitor->email = $request->input('email');
     $visitor->phone = $request->input('phone');
     $visitor->save();
     return redirect('auth/login');
     //return redirect($this->redirectPath('auth/login'))->with($this->statusVar, Lang::get('auth.addUserSuccess'));
 }
開發者ID:lanzhiwang,項目名稱:laravel-blog,代碼行數:13,代碼來源:PostController.php

示例4: statistics

 public function statistics()
 {
     $model = new Visitor();
     $model->user_type = 0;
     $model->user_id = Yii::app()->user->id;
     $model->user_name = Yii::app()->user->name;
     $model->server_time = new CDbExpression('NOW()');
     $model->page_title = $this->pageTitle;
     $model->page_link = Yii::app()->request->url;
     $model->browser = Yii::app()->browser->getBrowser();
     $model->visitor_ip = $_SERVER['REMOTE_ADDR'];
     $model->save();
 }
開發者ID:optimosolution,項目名稱:jasorbd,代碼行數:13,代碼來源:Controller.php

示例5: executeUpdate

 public function executeUpdate()
 {
     $member_code = $this->getRequestParameter('code');
     $member = MemberPeer::retrieveByCode($member_code);
     $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     $now = date('dmY');
     $time = date('Y/m/d h:i');
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($member->hasVisit()) {
         //$pk = $member()->getVisitorId()->getId();
         //$visitor = VisitorPeer::retrieveByPk($this->getRequestParameter('id'));
         $member_id = $member->getId();
         $visitor = VisitorPeer::retrieveByMember($member_id);
         $this->forward404Unless($visitor);
         //$c = new Criteria();
         //$c->add(VisitorPeer::ID, $pk);
         //$visitor = VisitorPeer::doSelectOne($c);
         $visitor->setTimeOut($time);
         $visitor->save();
         return $this->redirect('default/index2');
     } else {
         $visitor = new Visitor();
         $visitor->setId($this->getRequestParameter('id'));
         $visitor->setMemberId($member->getId());
         $visitor->setTimeIn($time);
         $visitor->setDepartmentId($dept->getId());
         $visitor->setCode($now);
         $visitor->save();
         return $this->redirect('default/index2');
     }
 }
開發者ID:taryono,項目名稱:school,代碼行數:35,代碼來源:actions.class.php

示例6: addArticleVisitorInfo

 /**
  * Add the visitor who have read this blog
  * @param int $id
  */
 public function addArticleVisitorInfo($id, $interval)
 {
     $ip = UtilNet::getClientIp();
     // 		echo $ip;
     //		$qq = new QQWry(long2ip($ip));
     //		echo $qq->getDetailInfo();
     $visitorInfo = Visitor::model()->find('ip = :ip AND aid = :aid', array(':ip' => $ip, ':aid' => $id));
     // 		UtilHelper::dump($visitorInfo->attributes);
     if ($visitorInfo) {
         $visitorInfo->lasttime = time();
         $visitorInfo->times++;
         $visitorInfo->alltime .= '|' . time();
         $visitorInfo->intervals .= '|' . $interval;
         if (!Yii::app()->user->isGuest) {
             $visitorInfo->uid = Yii::app()->user->id;
         }
         UtilHelper::writeToFile($visitorInfo->attributes);
         //			Yii::app()->end();
         try {
             $visitorInfo->save();
         } catch (Exception $e) {
             UtilHelper::dump($e);
         }
     } else {
         $visitorInfo = new Visitor();
         $visitorInfo->aid = $id;
         $visitorInfo->ip = $ip;
         $visitorInfo->lasttime = time();
         $visitorInfo->times = 1;
         $visitorInfo->intervals = $interval;
         if (!Yii::app()->user->isGuest) {
             $visitorInfo->uid = Yii::app()->user->id;
         }
         $visitorInfo->alltime = time();
         $visitorInfo->refer = $_SERVER['HTTP_REFERER'];
         $visitorInfo->terminal = $_SERVER['HTTP_USER_AGENT'];
         UtilHelper::writeToFile($visitorInfo->attributes);
         //			Yii::app()->end();
         if ($visitorInfo->save()) {
             // 				echo "OK";
         } else {
             //				echo "Fail";
         }
     }
 }
開發者ID:yunsite,項目名稱:my-advertise,代碼行數:49,代碼來源:Visitor.php

示例7: Visitor

 function add_visitor()
 {
     $visitor = new Visitor();
     $visitor->url_id = $this->tbl->id;
     $visitor->referrer = $_SERVER["HTTP_REFERER"];
     $visitor->created_by = $this->get_ip();
     $visitor->created_on = date('Y-m-d H:i:s');
     $visitor->save();
 }
開發者ID:hasanozgan,項目名稱:kissabe,代碼行數:9,代碼來源:shortener.php

示例8: actionHome

 public function actionHome($uid)
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect('./index.php?r=user/login');
     }
     $vhid = $uid;
     $user = User::model()->findByPk($uid);
     $user->visitor += 1;
     $user->save(false);
     if ($uid != Yii::app()->user->id) {
         $visit = new Visitor();
         $visit->uid = Yii::app()->user->id;
         $visit->toid = $uid;
         $visit->time = time();
         $visit->save(false);
     }
     //活躍用戶展示
     $yaya = User::model()->findAll(array('order' => 'update_time desc', 'limit' => 16));
     //思想展示
     $sql = "select * from {{article}} where author_id = {$uid} order by create_time desc limit 0, 20 ";
     $sixiang = Article::model()->findAllBySql($sql);
     //標簽展示
     $sq = "select * from {{usertags}} where uid = {$uid} order by create_time desc";
     $bq = Usertags::model()->findAllBySql($sq);
     //home頁麵用戶關注的丫丫數量
     $uf = "select * from {{follow}} where uid={$uid}";
     $userfollow = count(Follow::model()->findAllBySql($uf));
     //home頁麵粉絲數量
     $fan = "select * from {{follow}} where touid={$uid}";
     $fans = count(Follow::model()->findAllBySql($fan));
     //訪問我的主頁的用戶展示
     $userid = Yii::app()->user->id;
     $cs1 = "select *,count(distinct uid) from {{visitor}} where toid={$userid} group by uid order by time desc limit 16";
     $fangwenwo = Visitor::model()->findAllBySql($cs1);
     $cs2 = "select *,count(distinct toid) from {{visitor}} where uid={$vhid} group by toid order by time desc limit 16";
     $visitwho = Visitor::model()->findAllBySql($cs2);
     $data = array('user' => $user, 'yaya' => $yaya, 'sixiang' => $sixiang, 'bq' => $bq, 'userfollow' => $userfollow, 'fans' => $fans, 'fangwenwo' => $fangwenwo, 'visitwho' => $visitwho);
     $this->render('home', $data);
 }
開發者ID:SallyU,項目名稱:footprints,代碼行數:39,代碼來源:UserController.php


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