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


PHP Api::put方法代码示例

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


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

示例1: commit

 /**
  * Commit batch
  *
  * @throws \Exception
  */
 public function commit()
 {
     $response = $this->api->put('/v4/batch', ['batch-id' => $this->getBatchId()]);
     if (!isset($response['success']) || !$response['success']) {
         throw new \Exception("Response was not successful.");
     }
     $this->isCommitted = true;
 }
开发者ID:silktide,项目名称:brightlocal-api,代码行数:13,代码来源:Batch.php

示例2: create_token

 /**
  * Creates and returns a new token/api_key combination for the
  * specified user ID. Returns an array with the two values. Note
  * that for an existing user ID, this will generate a new pair,
  * replacing the old values and making them no longer valid for
  * API access.
  */
 public static function create_token($user_id)
 {
     $a = self::query()->where('user_id', $user_id)->single();
     if ($a && !$a->error) {
         $a->token = md5(uniqid(mt_rand(), 1));
         $a->api_key = md5(uniqid(mt_rand(), 1));
     } else {
         $a = new Api(array('token' => md5(uniqid(mt_rand(), 1)), 'api_key' => md5(uniqid(mt_rand(), 1)), 'user_id' => $user_id));
     }
     while (!$a->put()) {
         $a->token = md5(uniqid(mt_rand(), 1));
     }
     return array($a->token, $a->api_key);
 }
开发者ID:Selwyn-b,项目名称:elefant,代码行数:21,代码来源:Api.php

示例3: create_token

 /**
  * Creates and returns a new token/api_key combination for the
  * specified user ID. Returns an array with the two values. Note
  * that for an existing user ID, this will generate a new pair,
  * replacing the old values and making them no longer valid for
  * API access.
  */
 public static function create_token($user_id)
 {
     $a = Api::query()->where('user_id', $user_id)->fetch();
     if (count($a) > 0) {
         $a = $a[0];
         $a->token = md5(uniqid(mt_rand(), 1));
         $a->api_key = md5(uniqid(mt_rand(), 1));
     } else {
         $a = new Api(array('token' => md5(uniqid(mt_rand(), 1)), 'api_key' => md5(uniqid(mt_rand(), 1)), 'user_id' => $user_id));
     }
     while (!$a->put()) {
         $a->token = md5(uniqid(mt_rand(), 1));
     }
     return array($a->token, $a->api_key);
 }
开发者ID:nathanieltite,项目名称:elefant,代码行数:22,代码来源:Api.php

示例4: action_view

 public function action_view()
 {
     $id = (int) $this->request->param('id');
     $user_id = Auth::get_id();
     $message = Api::get('user-messages.get_by_id', array('id' => $id, 'uid' => $user_id, 'fields' => 'author,title,is_read,created_on,text,is_starred'))->as_object();
     if (!$message->response) {
         throw new HTTP_Exception_404('Message not found');
     }
     if ($this->request->method() === Request::POST) {
         $this->auto_render = FALSE;
         $post = $this->request->post();
         $post['from_user_id'] = $user_id;
         $post['parent_id'] = $id;
         return $this->_send(Api::put('user-messages', $post), $id);
     }
     $read = Api::post('user-messages.mark_read', array('id' => $id, 'uid' => $user_id));
     $messages = Api::get('user-messages.get', array('uid' => $user_id, 'fields' => 'author,from_user_id,title,is_read,created_on,text,is_starred', 'pid' => $id))->as_object();
     $this->template->content = View::factory('messages/view', array('tpl' => View::factory('messages/item'), 'message' => $message->response, 'messages' => $messages->response, 'from_user' => ORM::factory('user', $message->response->from_user_id)));
     $this->set_title($message->response->title);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:20,代码来源:messages.php

示例5: Api

<?php

require __DIR__ . '/credentials.php';
require __DIR__ . '/../facturama/Api.php';
$facturma = new Api(USER, PASSWORD);
$clientId = 'TGpJ_Ko32_ZSEPBcZXRnRw2';
/*$params = [
  'id' => $clientId
];*/
$body = ["Id" => $clientId, "Address" => ["Street" => "St One", "ExteriorNumber" => "15", "InteriorNumber" => "12", "Neighborhood" => "Lower Manhattan, ", "ZipCode" => "sample string 5", "Locality" => "sample string 6", "Municipality" => "sample string 7", "State" => "sample string 8", "Country" => "MX"], "Rfc" => "XEXX010101000", "Name" => "Test Test 2", "Email" => "test@facturma.com"];
//$result = $facturma->put('Client/' . $clientId, $body, $params);
$result = $facturma->put('Client/' . $clientId, $body);
printf('<pre>%s<pre>', var_export($result, true));
开发者ID:javiertelioz,项目名称:facturama-php-sdk,代码行数:13,代码来源:PutResquest.php


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