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


PHP ParseClient::getPushDateFormat方法代码示例

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


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

示例1: send

 /**
  * Sends a push notification.
  *
  * @param array $data         The data of the push notification.    Valid fields
  *                            are:
  *                            channels - An Array of channels to push to.
  *                            push_time - A Date object for when to send the push.
  *                            expiration_time -    A Date object for when to expire
  *                            the push.
  *                            expiration_interval - The seconds from now to expire the push.
  *                            where - A ParseQuery over ParseInstallation that is used to match
  *                            a set of installations to push to.
  *                            data - The data to send as part of the push
  * @param bool  $useMasterKey Whether to use the Master Key for the request
  *
  * @throws \Exception, ParseException
  *
  * @return mixed
  */
 public static function send($data, $useMasterKey = false)
 {
     if (isset($data['expiration_time']) && isset($data['expiration_interval'])) {
         throw new Exception('Both expiration_time and expiration_interval can\'t be set.');
     }
     if (isset($data['where'])) {
         if ($data['where'] instanceof ParseQuery) {
             $where_options = $data['where']->_getOptions();
             if (!isset($where_options['where'])) {
                 $data['where'] = '{}';
             } else {
                 $dd = $data['where']->_getOptions();
                 $data['where'] = $dd['where'];
             }
         } else {
             throw new Exception('Where parameter for Parse Push must be of type ParseQuery');
         }
     }
     if (isset($data['push_time'])) {
         //Local push date format is different from iso format generally used in Parse
         //Schedule does not work if date format not correct
         $data['push_time'] = ParseClient::getPushDateFormat($data['push_time'], isset($data['local_time']));
     }
     if (isset($data['expiration_time'])) {
         $cc = ParseClient::_encode($data['expiration_time'], false);
         $data['expiration_time'] = $cc['iso'];
     }
     return ParseClient::_request('POST', 'push', null, json_encode(ParseClient::_encode($data, true)), $useMasterKey);
 }
开发者ID:vaibbhav,项目名称:parse_php5.3_sdk,代码行数:48,代码来源:ParsePush.php


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