当前位置: 首页>>代码示例>>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;未经允许,请勿转载。