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


PHP SS_HTTPResponse::setStatusDescription方法代码示例

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


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

示例1: doSend

 public function doSend($data, $form)
 {
     try {
         $this->record->doSend();
     } catch (PushException $ex) {
         return new SS_HTTPResponse($this->ItemEditForm()->forAjaxTemplate(), 400, $ex->getMessage());
     }
     $response = new SS_HTTPResponse($this->ItemEditForm()->forAjaxTemplate());
     $response->setStatusDescription(_t('Push.PUSHSENT', 'The push notification has been sent'));
     return $response;
 }
开发者ID:silverstripe-australia,项目名称:silverstripe-push,代码行数:11,代码来源:PushNotificationsAdminItemRequest.php

示例2: remove

 /**
  * Action to handle removing a single file from the db relation
  * 
  * @param SS_HTTPRequest $request
  * @return SS_HTTPResponse
  */
 public function remove(SS_HTTPRequest $request)
 {
     // Check form field state
     if ($this->parent->isDisabled() || $this->parent->isReadonly()) {
         return $this->httpError(403);
     }
     // Protect against CSRF on destructive action
     $token = $this->parent->getForm()->getSecurityToken();
     if (!$token->checkRequest($request)) {
         return $this->httpError(400);
     }
     $response = new SS_HTTPResponse();
     $response->setStatusCode(500);
     $fieldName = $this->parent->getName();
     $record = $this->parent->getRecord();
     $id = $this->getItem()->ID;
     if ($id && $record && $record->exists()) {
         if (($record->has_many($fieldName) || $record->many_many($fieldName)) && ($file = $record->{$fieldName}()->byID($id))) {
             $record->{$fieldName}()->remove($file);
             $response->setStatusCode(200);
         } elseif ($record->has_one($fieldName) && $record->{$fieldName . 'ID'} == $id) {
             $record->{$fieldName . 'ID'} = 0;
             $record->write();
             $response->setStatusCode(200);
         }
     }
     if ($response->getStatusCode() != 200) {
         $response->setStatusDescription(_t('UploadField.REMOVEERROR', 'Error removing file'));
     }
     return $response;
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:37,代码来源:UploadField.php


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