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


PHP Auth::token方法代碼示例

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


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

示例1: POST_indexAction

 /**
  * 注冊
  * @method POST_indexAction
  * @param  string      $name [description]
  * @return [type]            [description]
  * @author NewFuture
  */
 public function POST_indexAction()
 {
     if (!($regInfo = Session::get('reg'))) {
         $this->response(0, '注冊信息失效');
     } else {
         /*檢查密碼*/
         if (Input::post('password', $password, 'isMD5')) {
             $msg = '成功設置了新的密碼作為雲印密碼!';
         } else {
             $msg = '使用剛才的驗證密碼作為運用登陸密碼!';
             $password = $regInfo['password'];
         }
         /*開始注冊*/
         $regInfo['password'] = Encrypt::encryptPwd($password, $regInfo['number']);
         if ($id = UserModel::insert($regInfo)) {
             /*注冊成功*/
             $msg .= '(如果下次忘記密碼後可以通過 手機,郵箱或者再次認證找回密碼)';
             $regInfo['id'] = $id;
             $token = Auth::token($regInfo);
             Cookie::set('token', $token);
             unset($regInfo['password']);
             Session::del('reg');
             Session::set('user', $regInfo);
             $this->response(1, ['user' => $regInfo, 'token' => $token, 'msg' => $msg]);
         } else {
             $this->response(0, '注冊失敗');
         }
     }
 }
開發者ID:derek-chow,項目名稱:YunYinService,代碼行數:36,代碼來源:User.php

示例2: registerAction

 /**
  * 確認注冊【設定密碼】
  * @method registerAction
  * @return [type]         [description]
  * @author NewFuture
  */
 public function registerAction()
 {
     $msg = '信息注冊失敗!';
     if ($regInfo = Session::get('reg')) {
         Session::del('reg');
         if (Input::post('password', $password, 'trim') === false) {
             /*密碼未md5*/
             $this->error('密碼錯誤', '/');
         } elseif (!$password) {
             /*未設置密碼*/
             $password = $regInfo['password'];
         }
         $regInfo['password'] = Encrypt::encryptPwd($password, $regInfo['number']);
         if ($id = UserModel::insert($regInfo)) {
             /*注冊成功*/
             $regInfo['id'] = $id;
             $token = Auth::token($regInfo);
             Cookie::set('token', [$id => $token]);
             unset($regInfo['password']);
             Session::set('user', $regInfo);
             $msg = '信息注冊成功!';
         }
     }
     $this->jump('/', $msg);
 }
開發者ID:derek-chow,項目名稱:YunYinService,代碼行數:31,代碼來源:Api.php

示例3: getMetaData

 function getMetaData($dataType)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/meta/';
     $request = $baseUrl . $endpoint . $dataType;
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_HTTPGET => true, CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:12,代碼來源:meta.php

示例4: unrelateProject

 function unrelateProject($id, $projectId)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/forminstance/';
     $request = $baseUrl . $endpoint . $id . '/unrelateproject?relatetoid=' . $projectId;
     $fields = [];
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_POSTFIELDS => http_build_query($fields), CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:formInstance.php

示例5: postPdata

 function postPdata($name, $scope, $persistedData, $dataMimeType, $linkedObjectId, $linkedObjectType, $expirationDateUtc)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/persistedData';
     $fields = ['name' => $name, 'scope' => $scope, 'persistedData' => $persistedData, 'dataMimeType' => $dataMimeType, 'linkedObjectId' => $linkedObjectId, 'linkedObjectType' => $linkedObjectType, 'expirationDateUtc' => $expirationDateUtc];
     $request = $baseUrl . $endpoint;
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_POST => true, CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_URL => $request, CURLOPT_POSTFIELDS => http_build_query($fields), CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:pData.php

示例6: postEmails

 function postEmails($recipients, $ccRecipients, $subject, $body)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/emails';
     $request = $baseUrl . $endpoint;
     $fields = ['recipients' => $recipients, 'ccrecipients' => $ccRecipients, 'subject' => $subject, 'body' => $body];
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_POST => true, CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_POSTFIELDS => http_build_query($fields), CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:emails.php

示例7: postFile

 function postFile($filePath, $mimeType, $fileName, $docId, $name, $revisionNumber, $checkInDocState, $indexFields)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/files';
     $request = $baseUrl . $endpoint;
     $fileUpload = new CURLFILE($filePath, $mimeType, $fileName);
     $fields = ['documentId' => $docId, 'name' => $name, 'revision' => $revisionNumber, 'changeReason' => '1', 'checkInDocumentState' => $checkInDocState, 'indexFields' => $indexFields, 'fileName' => $fileName, 'fileUpload' => $fileUpload];
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_POST => 1, CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_POSTFIELDS => $fields, CURLOPT_URL => $request));
     curl_exec($ch);
     curl_close($ch);
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:files.php

示例8: putUsers

 function putUsers($id, $fName, $lName, $email)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/users/';
     $request = $baseUrl . $endpoint . $id;
     $fields = ['firstName' => $fName, 'lastName' => $lName, 'emailaddress' => $email];
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_URL => $request, CURLOPT_POSTFIELDS => http_build_query($fields), CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:users.php

示例9: putGroups

 function putGroups($id, $name, $description)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/groups/';
     $request = $baseUrl . $endpoint . $id;
     $fields = ['name' => $name, 'description' => $description];
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_POSTFIELDS => http_build_query($fields), CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:groups.php

示例10: login

 /**
  * 登錄函數
  * @method login
  * @access private
  * @author NewFuture[newfuture@yunyin.org]
  * @param  [string]   $password    [md5密碼]
  * @return [bool/int] [用戶id]
  */
 private function login($number, $password, $sch_id = null)
 {
     $conditon = ['number' => $number];
     //指定學校
     $sch_id and $conditon['sch_id'] = $sch_id;
     $users = UserModel::where($conditon)->select('id,password,sch_id,name');
     if (empty($users)) {
         /*未注冊*/
         return null;
     } else {
         /*驗證結果*/
         $password = Encrypt::encryptPwd($password, $number);
         $reg_schools = [];
         foreach ($users as &$user) {
             if ($user['password'] == $password) {
                 /*登錄成功*/
                 $user['number'] = $number;
                 $token = Auth::token($user);
                 $sessionid = Session::start();
                 unset($user['password']);
                 Session::set('user', $user);
                 Cookie::set('token', $token);
                 // $user['school'] = SchoolModel::getName($user['sch_id']);
                 $result = ['sid' => $sessionid, 'user' => $user, 'msg' => '登錄成功!', 'token' => $token];
                 $this->response(1, $result);
                 return true;
             } else {
                 /*驗證失敗*/
                 $sid = $user['sch_id'];
                 $reg_schools[$sid] = School::getAbbr($sid);
             }
         }
         $this->reg_schools = $reg_schools;
         return false;
     }
 }
開發者ID:derek-chow,項目名稱:YunYinService,代碼行數:44,代碼來源:Auth.php

示例11: reviseFormInstance

 function reviseFormInstance($id, $revId, $fieldsValueArray)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/formtemplates/';
     $request = $baseUrl . $endpoint . $id . '/forms/' . $revId;
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_POST => true, CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_POSTFIELDS => http_build_query($fieldsValueArray), CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:12,代碼來源:formTemplates.php

示例12: putFolderIndexFields

 function putFolderIndexFields($folderId, $id, $queryId, $dropDownListId, $required, $defaultValue)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/folders/';
     $request = $baseUrl . $endpoint . $folderId . '/indexfields/' . $id;
     $fields = ['queryId' => $queryId, 'queryValueField' => '', 'queryDisplayField' => '', 'dropDownListId' => $dropDownListId, 'required' => $required, 'defaultValue' => $defaultValue];
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_POSTFIELDS => http_build_query($fields), CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:folders.php

示例13: postDoc

 function postDoc($folderId, $documentState, $name, $description, $fileName, $indexFields)
 {
     $AccessToken = Auth::token();
     $baseUrl = url . '/api/v1/' . customerAlias . '/' . databaseAlias;
     $endpoint = '/documents';
     $request = $baseUrl . $endpoint;
     $fields = ['folderId' => $folderId, 'documentState' => $documentState, 'name' => $name, 'description' => $description, 'revision' => '1', 'allowNoFile' => true, 'fileLength' => 0, 'fileName' => $fileName, 'indexFields' => $indexFields];
     $ch = curl_init();
     curl_setopt_array($ch, array(CURLOPT_POST => true, CURLOPT_HTTPHEADER => array('Authorization: Bearer ' . $AccessToken), CURLOPT_POSTFIELDS => http_build_query($fields), CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => 1));
     $response = curl_exec($ch);
     curl_close($ch);
     return $response;
 }
開發者ID:VisualVault,項目名稱:php-rest-client-library,代碼行數:13,代碼來源:documents.php


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