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


PHP ApiException::setAdditionalInfo方法代码示例

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


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

示例1: __doCurl

 private static function __doCurl($url, $data, $additionalHeaders)
 {
     $curlHandle = curl_init($url);
     if ($curlHandle === FALSE) {
         $exception = new ApiException("Failed to connect to url {$url}", Config::$LOG_LEVEL_ERROR_KEY);
         $exception->setAdditionalInfo("source", "ApiCurl::__doCurl");
         $exception->setAdditionalInfo("url", $url);
         throw $exception;
     }
     if (!empty($data)) {
         curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $data);
         curl_setopt($curlHandle, CURLOPT_POST, 1);
     }
     curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($curlHandle, CURLOPT_MAXREDIRS, Config::$CURL_MAX_REDIRECTS);
     curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, Config::$CURL_CONNECTION_TIMEOUT);
     if (!empty($additionalHeaders)) {
         foreach ($additionalHeaders as $key => $value) {
             curl_setopt($curlHandle, $key, $value);
         }
     }
     $result = curl_exec($curlHandle);
     curl_close($curlHandle);
     if ($result === FALSE) {
         $exception = new ApiException("Failed to exec curl to {$url}", Config::$LOG_LEVEL_ERROR_KEY);
         $exception->setAdditionalInfo("source", "ApiCurl::__doCurl");
         $exception->setAdditionalInfo("url", $url);
         $exception->setAdditionalInfo("data", $data);
         $exception->setAdditionalInfo("additionalHeaders", $additionalHeaders);
         throw $exception;
     }
     return $result;
 }
开发者ID:reysub,项目名称:MVC-Template,代码行数:34,代码来源:ApiCurl.php

示例2: delete

 public static function delete($key)
 {
     unset($_COOKIE[$key]);
     if (!setcookie($key, NULL, time() - 1, "/")) {
         $exception = new ApiException("Failed to set cookie {$key}", Config::$LOG_LEVEL_WARNING_KEY);
         $exception->setAdditionalInfo("source", "ApiCookies::delete");
         $exception->setAdditionalInfo("key", $key);
         throw $exception;
     }
 }
开发者ID:reysub,项目名称:MVC-Template,代码行数:10,代码来源:ApiCookies.php

示例3: __sendMail

 private static function __sendMail($sender, $receivers, $subject, $body, $replyTo, $ccs, $bccs, $contentType)
 {
     $replyTo = self::__parseField(empty($replyTo) ? $sender : $replyTo);
     $sender = self::__parseField($sender);
     $receivers = self::__parseField($receivers);
     $ccs = self::__parseField($ccs);
     $bccs = self::__parseField($bccs);
     $headers = self::__composeHeaders($sender["forHeaders"], $receivers["forHeaders"], $subject, $replyTo["forHeaders"], $ccs["forHeaders"], $bccs["forHeaders"], $contentType);
     if (!mail($receivers["forEmail"], $subject, $body, $headers)) {
         $exception = new ApiException("Failed to send email", Config::$LOG_LEVEL_WARNING_KEY);
         $exception->setAdditionalInfo("source", "ApiMail::__sendMail");
         $exception->setAdditionalInfo("sender", $sender);
         $exception->setAdditionalInfo("receivers", $receivers);
         $exception->setAdditionalInfo("subject", $subject);
         $exception->setAdditionalInfo("body", $body);
         $exception->setAdditionalInfo("replyTo", $replyTo);
         $exception->setAdditionalInfo("ccs", $ccs);
         $exception->setAdditionalInfo("bccs", $bccs);
         $exception->setAdditionalInfo("contentType", $contentType);
         throw $exception;
     }
 }
开发者ID:reysub,项目名称:MVC-Template,代码行数:22,代码来源:ApiMail.php

示例4: deleteDirectory

 public static function deleteDirectory($directory)
 {
     $content = self::getDirectoryContent($directory, TRUE, FALSE);
     foreach ($content as $element) {
         if (is_dir($element)) {
             self::deleteDirectory($directory . $element);
         } else {
             self::deleteFile($directory . $element);
         }
     }
     if (!rmdir($directory)) {
         $exception = new ApiException("Failed to delete directory {$directory}", Config::$LOG_LEVEL_ERROR_KEY);
         $exception->setAdditionalInfo("source", "ApiStorage::deleteDirectory");
         $exception->setAdditionalInfo("directory", $directory);
         throw $exception;
     }
 }
开发者ID:reysub,项目名称:MVC-Template,代码行数:17,代码来源:ApiStorage.php


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