当前位置: 首页>>代码示例>>PHP>>正文


PHP Rest::post方法代码示例

本文整理汇总了PHP中Rest::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Rest::post方法的具体用法?PHP Rest::post怎么用?PHP Rest::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rest的用法示例。


在下文中一共展示了Rest::post方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: oAuthRefreshToken

 public static function oAuthRefreshToken($user = array(), $updateSession = false, $force = false)
 {
     $expires = time() + 1000;
     if (isset($user['credentials']['expires_at'])) {
         $expires = strtotime($user['credentials']['expires_at']);
     }
     if ($expires < time() || $force) {
         $payload = array('client_id' => OAUTH_CLIENT_ID, 'client_secret' => OAUTH_CLIENT_SECRET, 'grant_type' => 'refresh_token', 'refresh_token' => $user['credentials']['refresh_token']);
         $refreshedToken = Rest::post('https://accounts.google.com/o/oauth2/token', $payload);
         if ($refreshedToken) {
             // Credentials
             $credentials = UsersCredentialsModel::first(array('user_id' => $user['username']['id']));
             $credentials->access_token = $refreshedToken['access_token'];
             $credentials->token_type = $refreshedToken['token_type'];
             $credentials->expires_at = date(DATE_TIME, time() + $refreshedToken['expires_in']);
             $credentials->save();
             // Refresh session data
             if ($updateSession) {
                 $_SESSION['usernames'][$user['username']['id']]['credentials']['access_token'] = $credentials->access_token;
                 $_SESSION['usernames'][$user['username']['id']]['credentials']['expires_at'] = $credentials->expires_at;
                 if ($_SESSION['current']['username']['id'] == $user['username']['id']) {
                     $_SESSION['current'] = $_SESSION['usernames'][$user['username']['id']];
                 }
             }
             $user['credentials']['access_token'] = $credentials->access_token;
             $user['credentials']['expires_at'] = $credentials->expires_at;
         }
         return $refreshedToken;
     }
     return $user;
 }
开发者ID:unDemian,项目名称:gcdc-migrate,代码行数:31,代码来源:Auth.php

示例2: post

 public function post()
 {
     $req_field = array('user_id' => "", 'calendar_id' => "");
     $post = $_POST;
     $data = array();
     foreach ($req_field as $key => $value) {
         if (!empty($post[$key])) {
             $data[$key] = $post[$key];
         }
     }
     if (count($data) == count($req_field)) {
         $this->_data = $data;
         $return = parent::post();
     } else {
         $return = array();
     }
     return json_encode($return);
 }
开发者ID:bshabanov,项目名称:temptasks,代码行数:18,代码来源:resources.php

示例3: FileManagerApi

<?php

namespace AngularFilemanager\LocalBridge;

/**
 *  PHP Local filesystem bridge for angular-filemanager
 *  
 *  @author Jakub Ďuraš <jakub@duras.me>
 *  @version 0.1.0
 */
include 'LocalBridge/Response.php';
include 'LocalBridge/Rest.php';
include 'LocalBridge/Translate.php';
include 'LocalBridge/FileManagerApi.php';
//Takes two arguments - base path without last slash (default: '$currentDirectory/../files'); language (default: 'en'); mute_errors (default: true, will call ini_set('display_errors', 0))
$fileManagerApi = new FileManagerApi();
$rest = new Rest();
$rest->post([$fileManagerApi, 'postHandler'])->get([$fileManagerApi, 'getHandler'])->handle();
开发者ID:bhupendra-bhudia,项目名称:angular-filemanager,代码行数:18,代码来源:index.php


注:本文中的Rest::post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。