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


PHP Response::ok方法代码示例

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


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

示例1: inmueblesDestacados

 private function inmueblesDestacados()
 {
     $inmuebles = Inmueble::findDestacados();
     $arrInmuebles = array();
     foreach ($inmuebles as $inm) {
         array_push($arrInmuebles, $inm->toArray());
     }
     Response::ok(CJSON::encode($arrInmuebles));
 }
开发者ID:MRodriguez08,项目名称:yii-bundles-app,代码行数:9,代码来源:RwsinmuebleController.php

示例2: processGet

 public function processGet()
 {
     $list = Product::model()->findAll();
     $items = array();
     foreach ($list as $p) {
         array_push($items, array("id" => $p->id, "name" => $p->name, "description" => $p->description, "images" => $p->images));
     }
     Response::ok(CJSON::encode(array("version" => "xxxxxxxxxxxxxxxxxxx", "items" => $items)));
 }
开发者ID:MRodriguez08,项目名称:yii-bundles-app,代码行数:9,代码来源:RwscatalogueController.php

示例3: postDevice

 public function postDevice()
 {
     if (Input::has('device_type') && Input::has('token')) {
         $deviceType = Input::get('device_type');
         $token = Input::get('token');
         $user = Auth::getUser();
         $user->device_type = $deviceType;
         $user->device_token = $token;
         $user->save();
         return Response::ok($user);
     } else {
         return Response::error('Missing parameters');
     }
 }
开发者ID:nikammarafiy,项目名称:find-my-friends,代码行数:14,代码来源:MeController.php

示例4: postRegister

 public function postRegister()
 {
     if (Input::has('email') && Input::has('password') && Input::has('name')) {
         $email = Input::get('email');
         $password = Input::get('password');
         $name = Input::get('name');
         $user = $this->registerService->register($email, $name, $password);
         if ($user === NULL) {
             return Response::error('Failed to register');
         } else {
             return Response::ok($user);
         }
     } else {
         return Response::error('Missing parameters');
     }
 }
开发者ID:nikammarafiy,项目名称:find-my-friends,代码行数:16,代码来源:LoginController.php

示例5: createNotification

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 private function createNotification()
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         $ntf = new Notification();
         $ntf->customSetAttributes($this->arguments);
         if ($ntf->save()) {
             $transaction->commit();
             Response::ok(CJSON::encode(array("result" => Constants::RESULTADO_OPERACION_EXITO, "message" => "notificacion con id = {$ntf->id} ingresada con exito")));
         } else {
             $transaction->rollback();
             Response::ok(CJSON::encode(array("result" => Constants::RESULTADO_OPERACION_FALLA, "message" => $ntf->getErrors())));
         }
     } catch (\Exception $e) {
         $transaction->rollback();
         Yii::log($e->getMessage(), DBLog::LOG_LEVEL_ERROR);
         Response::error(CJSON::encode(array("result" => Constants::RESULTADO_OPERACION_FALLA, "message" => Yii::app()->params["httpErrorCode500Message"])));
     }
 }
开发者ID:MRodriguez08,项目名称:yii-bundles-app,代码行数:23,代码来源:RwsnotificationController.php

示例6: deleteIndex

 public function deleteIndex()
 {
     $user = Auth::getUser();
     if (Input::has('id')) {
         $friendUser = $this->meService->getUser(Input::get('id'));
         if ($friendUser === null) {
             return Response::error('Invalid friend id');
         }
         $response = $this->meService->deleteFriendship($user, $friendUser);
         if ($response !== null) {
             return Response::ok($response);
         } else {
             return Response::error('Failed to delete friendship');
         }
     } else {
         return Response::error('Missing parameters');
     }
 }
开发者ID:nikammarafiy,项目名称:find-my-friends,代码行数:18,代码来源:FriendController.php

示例7: ok

 public function ok()
 {
     $r = Response::ok();
     $this->assertEquals(200, $r->status);
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:5,代码来源:ResponseTest.class.php

示例8: actionGetAllEvents

 public function actionGetAllEvents()
 {
     $out = array();
     try {
         $events = Event::model()->findAll("user_id=:userId", array("userId" => Yii::app()->user->id));
         foreach ($events as $e) {
             $item = array('id' => $e->id, 'title' => $e->title, 'url' => Yii::app()->baseUrl . '/index.php/event/' . $e->id, 'class' => 'event-important', 'start' => $e->start . '000', 'end' => $e->end . '000');
             array_push($out, $item);
         }
         Response::ok(CJSON::encode(array('success' => 1, 'result' => $out)));
     } catch (Exception $exc) {
         Yii::log($exc->getMessage(), DBLog::LOG_LEVEL_ERROR);
         Response::error(CJSON::encode(array("result" => "error", "message" => Yii::app()->params["httpErrorCode500Message"])));
     }
 }
开发者ID:MRodriguez08,项目名称:yii-bundles-app,代码行数:15,代码来源:CalendarController.php

示例9: actionGetPendingNotifications

 public function actionGetPendingNotifications()
 {
     Response::ok(CJSON::encode(Notification::model()->findAll('id_estado_notificacion=:idEstado', array("idEstado" => 1))));
 }
开发者ID:MRodriguez08,项目名称:yii-bundles-app,代码行数:4,代码来源:NotificationController.php

示例10: processGet

 public function processGet()
 {
     Response::ok(CJSON::encode(Brand::model()->findAll()));
 }
开发者ID:pelo8888,项目名称:php-angular-yii,代码行数:4,代码来源:BrandController.php


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