當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。