當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Response::send方法代碼示例

本文整理匯總了PHP中Response::send方法的典型用法代碼示例。如果您正苦於以下問題:PHP Response::send方法的具體用法?PHP Response::send怎麽用?PHP Response::send使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Response的用法示例。


在下文中一共展示了Response::send方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionIndex

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionIndex()
 {
     //echo CJSON::encode("ok");
     //Yii::app()->end();
     if (isset($_POST['Company'])) {
         $id = (int) $_POST['Company'];
         //
         //if has access
         //$database= Company::model()->findByPk($id);
         Yii::log($id, 'info', 'app');
         //Yii::app()->user->setState('Database',$database );
         //Yii::app()->user->setState('Company',$id);
         //echo 'ok';
         Company::model()->select($id);
         //redirect
         Response::send();
     }
     if (Yii::app()->user->Company != 0) {
         Yii::app()->user->setState('Company', 0);
         $this->redirect('company');
         Yii::app()->end();
     }
     $model = new Company('search');
     $model->unsetAttributes();
     // clear any default values
     $this->render('index', array('model' => $model));
 }
開發者ID:hkhateb,項目名稱:linet3,代碼行數:31,代碼來源:CompanyController.php

示例2: preview_page

 public function preview_page()
 {
     $page = Page::getByID(intval($_REQUEST['cID'], 10), 'RECENT');
     if (!is_object($page) || $page->isError()) {
         throw new \InvalidArgumentException('Invalid collection ID');
     }
     $permissions = new Permissions($page);
     if ($permissions->canPreviewPageAsUser() && $permissions->canRead() && Config::get('concrete.permissions.model') == 'advanced') {
         /** @var Request $request */
         $request = Request::getInstance();
         $request->setCustomRequestUser(false);
         $request->setCurrentPage($page);
         if ($request->request('customUser')) {
             $user_info = UserInfo::getByUserName($request->request('customUser'));
             if ($user_info && is_object($user_info) && !$user_info->isError()) {
                 $request->setCustomRequestUser($user_info);
             }
         }
         $request->setCustomRequestDateTime(Core::make('helper/form/date_time')->translate('preview_as_user_datetime', $request->request()));
         $controller = $page->getPageController();
         $view = $controller->getViewObject();
         $response = new \Response();
         $response->setContent($view->render());
         $response->send();
     }
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:26,代碼來源:preview_as_user.php

示例3: run

 public function run()
 {
     $route = $this->router->match($this->request);
     if ($route === false) {
         $actionName = self::ACTION_NOT_FOUND;
     } else {
         $actionName = $route->getName();
     }
     if (!$this->actions->has($actionName)) {
         throw new \Exception(sprintf('Action %s not found', $actionName));
     }
     $this->store->setFileName($actionName);
     if ($this->request->isAjax()) {
         $this->view->setRenderType(View::RENDER_JSON);
     } else {
         $this->view->setContentView('error');
     }
     $action = $this->actions->get($actionName);
     call_user_func_array($action, array($this));
     if (is_callable($this->postAction)) {
         call_user_func_array($this->postAction, array($this));
     }
     $this->response->setContent($this->view->render());
     $this->response->send();
 }
開發者ID:Acidburn0zzz,項目名稱:devtools-1,代碼行數:25,代碼來源:Application.php

示例4: to

 public static function to($url)
 {
     Response::clean();
     Response::header('Location', $url);
     Response::send();
     exit;
 }
開發者ID:evil-enterprises,項目名稱:phpcore,代碼行數:7,代碼來源:Redirect.php

示例5: handle

 /**
  * When this type of exception isn't caught this method is called by
  * Error::exception_handler() to deal with the problem.
  */
 public function handle()
 {
     $response = new \Response(\View::forge('404'), 404);
     \Event::shutdown();
     $response->send(true);
     return;
 }
開發者ID:quickpacket,項目名稱:noclayer,代碼行數:11,代碼來源:request.php

示例6: preview

 public function preview()
 {
     $request = \Request::getInstance();
     $c = \Page::getByID($this->request->get('cID'));
     $cp = new \Permissions($c);
     if ($cp->canViewPageVersions()) {
         $c->loadVersionObject(\Core::make('helper/security')->sanitizeInt($_REQUEST['cvID']));
         $spoofed_request = \Request::createFromGlobals();
         if ($device_handle = $request->headers->get('x-device-handle')) {
             if ($device = \Core::make('device/manager')->get($device_handle)) {
                 if ($agent = $device->getUserAgent()) {
                     $spoofed_request->headers->set('User-Agent', $agent);
                 }
             }
         }
         $spoofed_request->setCustomRequestUser(-1);
         $spoofed_request->setCurrentPage($c);
         \Request::setInstance($spoofed_request);
         $controller = $c->getPageController();
         $controller->runTask('view', array());
         $view = $controller->getViewObject();
         $response = new \Response();
         $content = $view->render();
         // Reset just in case.
         \Request::setInstance($request);
         $response->setContent($content);
         $response->send();
         exit;
     }
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:30,代碼來源:devices.php

示例7: hookRequest

 /**
  * @mcms_message ru.molinos.cms.page.content
  */
 public static function hookRequest(Context $ctx)
 {
     if (true === self::isLocked($ctx)) {
         $r = new Response(t('На сервере ведутся технические работы, обратитесь чуть позже.'), 'text/plain', 503);
         $r->send();
     }
 }
開發者ID:umonkey,項目名稱:molinos-cms,代碼行數:10,代碼來源:class.maintenancemodule.php

示例8: error

 public static function error($message, $status = 501)
 {
     Event::trigger('api.error', [$message, $status]);
     Response::status($status);
     Response::json(['error' => ['type' => 'fatal', 'status' => $status, 'message' => $message]]);
     Response::send();
     exit;
 }
開發者ID:caffeina-core,項目名稱:api,代碼行數:8,代碼來源:API.php

示例9: dispatch

 public function dispatch(Route $route, Request $request, Response $response)
 {
     $controller = __NAMESPACE__ . '\\Controllers\\' . $route->getController();
     $action = $route->getAction();
     $foo = new $controller($request, $response);
     $foo->{$action}();
     $response->send();
 }
開發者ID:JorgePV,項目名稱:FrontController,代碼行數:8,代碼來源:HttpDispatcher.php

示例10: run

 /**
  * 執行應用程序
  * @access public
  * @return void
  */
 public static function run()
 {
     // 注冊錯誤和異常處理機製 以及初始化配置
     register_shutdown_function('\\think\\Error::appShutdown');
     set_error_handler('\\think\\Error::appError');
     set_exception_handler('\\think\\Error::appException');
     Config::load(THINK_PATH . 'config' . EXT);
     // 初始化應用(公共模塊) 初始化變量配置
     self::initModule(COMMON_MODULE, Config::get());
     // 獲取配置參數
     $config = Config::get();
     // 設置係統時區
     date_default_timezone_set($config['default_timezone']);
     // 監聽app_init
     APP_HOOK && Hook::listen('app_init');
     // 開啟多語言機製
     // 啟動session CLI 不開啟
     if (!IS_CLI && $config['use_session']) {
         Session::init($config['session']);
     }
     if (empty(self::$dispatch['type'])) {
         // 未指定調度類型 則進行URL路由檢測
         self::route($config);
     }
     // 記錄路由信息
     APP_DEBUG && Log::record('[ ROUTE ] ' . var_export(self::$dispatch, true), 'info');
     // 監聽app_begin
     APP_HOOK && Hook::listen('app_begin');
     // 根據類型調度
     switch (self::$dispatch['type']) {
         case 'redirect':
             // 執行重定向跳轉
             header('Location: ' . self::$dispatch['url'], true, self::$dispatch['status']);
             break;
         case 'module':
             // 模塊/控製器/操作
             $data = self::module(self::$dispatch['module'], $config);
             break;
         case 'controller':
             // 執行控製器操作
             //$data = Loader::action(self::$dispatch['controller'], self::$dispatch['params']);
             break;
         case 'method':
             // 執行回調方法
             $data = self::invokeMethod(self::$dispatch['method'], self::$dispatch['params']);
             break;
         case 'function':
             // 規則閉包
             $data = self::invokeFunction(self::$dispatch['function'], self::$dispatch['params']);
             break;
         default:
             throw new Exception('dispatch type not support', 10008);
     }
     // 監聽app_end
     APP_HOOK && Hook::listen('app_end', $data);
     // 輸出數據到客戶端
     return Response::send($data, Response::type(), Config::get('response_return'));
 }
開發者ID:livingvirus,項目名稱:cyfthink,代碼行數:63,代碼來源:App.php

示例11: show

 function show()
 {
     $configuration = new Config();
     $database = new SafeMySQL(array('user' => $configuration->db->username, 'pass' => $configuration->db->password, 'db' => $configuration->db->database, 'charset' => $configuration->db->charset));
     $data = $database->getAll('SELECT * FROM students');
     $response = new Response();
     $response->setContent(json_encode($data));
     $response->send();
 }
開發者ID:jenyaukraine,項目名稱:mindk,代碼行數:9,代碼來源:Students.class.php

示例12: about

 function about(Request $request, Response $response)
 {
     $this->v->set_tplname('mod_default_about');
     $this->nav_flag1 = 'about';
     if ($request->is_hashreq()) {
     } else {
     }
     $response->send($this->v);
 }
開發者ID:GavinLai,項目名稱:SimMatch,代碼行數:9,代碼來源:Default_Controller.php

示例13: viaJavaScript

 public static function viaJavaScript($url, $parent = false)
 {
     if ($link = Filter::with('core.redirect', $url)) {
         Response::type('text/html');
         Response::add('<script>' . ($parent ? 'parent.' : '') . 'location.href="', addslashes($link), '"</script>');
         Response::send();
         exit;
     }
 }
開發者ID:caffeina-core,項目名稱:core,代碼行數:9,代碼來源:Redirect.php

示例14: returnSuccess

 protected function returnSuccess($data, $message = null)
 {
     $res = new Response();
     $res->success = true;
     $res->data = $data;
     $res->message = $message;
     $res->send();
     exit;
 }
開發者ID:Etoma,項目名稱:pfadi-goesgen,代碼行數:9,代碼來源:AbstractHandler.php

示例15: send

 public function send()
 {
     $location = $this->location;
     if (!preg_match('#^https?://#', $location)) {
         $location = $this->getSchema() . '://' . $_SERVER['HTTP_HOST'] . $location;
     }
     $this->addHeader('Location: ' . $location);
     parent::send();
 }
開發者ID:miknatr,項目名稱:bravicility,代碼行數:9,代碼來源:RedirectResponse.php


注:本文中的Response::send方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。