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


PHP Request类代码示例

本文整理汇总了PHP中Request的典型用法代码示例。如果您正苦于以下问题:PHP Request类的具体用法?PHP Request怎么用?PHP Request使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param Request   $request
  * @param Exception $exception
  *
  * @return Response
  */
 public function render($request, Exception $exception)
 {
     if (!$request->is(config('jsonapi.url'))) {
         return parent::render($request, $exception);
     }
     return $this->handle($request, $exception);
 }
开发者ID:askedio,项目名称:laravel-cruddy,代码行数:15,代码来源:Handler.php

示例2: onAction

 function onAction()
 {
     global $application;
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     $SessionPost["ViewState"]["ErrorsArray"] = array();
     $fsr_id = $SessionPost["FsRule_id"] = intval($SessionPost["FsRule_id"]);
     $SessionPost["FsRuleName"] = trim($SessionPost["FsRuleName"]);
     $SessionPost["FsRuleMinSubtotal"] = floatval($SessionPost["FsRuleMinSubtotal"]);
     $SessionPost["FsRuleStrictCart"] = intval($SessionPost["StrictCart"]);
     if ($SessionPost["FsRuleName"] == "") {
         $SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_EMPTY_RULE_NAME";
     }
     $is_unique = modApiFunc("Shipping_Cost_Calculator", "checkIfFsRuleIsUnique", $SessionPost["FsRuleName"], $fsr_id);
     if (!$is_unique) {
         $SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_NOT_UNIQUE_RULE_NAME";
     }
     if ($SessionPost["FormSubmitValue"] == "Save") {
         if (count($SessionPost["ViewState"]["ErrorsArray"]) == 0) {
             unset($SessionPost["ViewState"]["ErrorsArray"]);
             $this->saveSettings($SessionPost);
             $SessionPost["ViewState"]["hasCloseScript"] = "true";
         }
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->setKey('FsRule_id', $fsr_id);
     $application->redirect($request);
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:32,代码来源:update_fs_rule.php

示例3: getCoordinates

 /**
  * {@inheritdoc}
  */
 public function getCoordinates($street = null, $postal = null, $city = null, $country = null, $fullAddress = null)
 {
     // Generate a new container.
     $objReturn = new Container();
     // Set the query string.
     $sQuery = $this->getQueryString($street, $postal, $city, $country, $fullAddress);
     $objReturn->setSearchParam($sQuery);
     $oRequest = null;
     $oRequest = new \Request();
     $oRequest->send(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
     $objReturn->setUri(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
     if ($oRequest->code == 200) {
         $aResponse = json_decode($oRequest->response, 1);
         if (!empty($aResponse['status']) && $aResponse['status'] == 'OK') {
             $objReturn->setLatitude($aResponse['results'][0]['geometry']['location']['lat']);
             $objReturn->setLongitude($aResponse['results'][0]['geometry']['location']['lng']);
         } elseif (!empty($aResponse['error_message'])) {
             $objReturn->setError(true);
             $objReturn->setErrorMsg($aResponse['error_message']);
         } else {
             $objReturn->setError(true);
             $objReturn->setErrorMsg($aResponse['Status']['error_message']);
         }
     } else {
         // Okay nothing work. So set all to Error.
         $objReturn->setError(true);
         $objReturn->setErrorMsg('Could not find coordinates for address "' . $sQuery . '"');
     }
     return $objReturn;
 }
开发者ID:designs2,项目名称:filter_perimetersearch,代码行数:33,代码来源:GoogleMaps.php

示例4: getCommand

 function getCommand(Request $req)
 {
     $previous = $req->getLastCommand();
     if (!$previous) {
         $cmd = $req->getProperty('cmd');
         if (!$cmd) {
             $req->setProperty('cmd', 'default');
             return self::$default_cmd;
         }
     } else {
         $cmd = $this->getForward($req);
         if (!$cmd) {
             return null;
         }
     }
     $cmd_obj = $this->resolveCommand($cmd);
     if (!$cmd_obj) {
         throw new \woo\base\AppException("couldn't resolve '{$cmd}'");
     }
     $cmd_class = get_class($cmd_obj);
     if (isset($this->invoked[$cmd_class])) {
         throw new \woo\base\AppException("circular forwarding");
     }
     $this->invoked[$cmd_class] = 1;
     return $cmd_obj;
 }
开发者ID:jabouzi,项目名称:projet,代码行数:26,代码来源:AppController.php

示例5: run

 public static function run(Request $peticion)
 {
     $controller = $peticion->getControlador() . 'Controller';
     $rutaControlador = ROOT . 'controllers' . DS . $controller . '.php';
     $metodo = $peticion->getMetodo();
     $args = $peticion->getArgs();
     if (is_readable($rutaControlador)) {
         require_once $rutaControlador;
         $controller = new $controller();
         //instanciando clase del indexController
         if (is_callable(array($controller, $metodo))) {
             $metodo = $peticion->getMetodo();
         } else {
             $metodo = 'index';
         }
         if ($args != null) {
             call_user_func_array(array($controller, $metodo), $args);
             //en un arreglo enviamos nombre de clase y metodo que queremos llamar y parametros que queremos pasar
         } else {
             call_user_func(array($controller, $metodo));
         }
     } else {
         throw new Exception('Controller no encontrado: ' . $rutaControlador);
     }
 }
开发者ID:tsyacom,项目名称:panamericanaWS_H2H,代码行数:25,代码来源:Bootstrap.php

示例6: outputMoveHref

 function outputMoveHref()
 {
     $request = new Request();
     $request->setView('MoveProducts');
     $request->setAction('MoveToProducts');
     return $request->getURL();
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:7,代码来源:move_products_az.php

示例7: run

 public static function run()
 {
     spl_autoload_register(['Bootstrap', 'autoload']);
     putenv('LANG=en_US.UTF-8');
     setlocale(LC_CTYPE, 'en_US.UTF-8');
     date_default_timezone_set(@date_default_timezone_get());
     session_start();
     $session = new Session($_SESSION);
     $request = new Request($_REQUEST);
     $setup = new Setup($request->query_boolean('refresh', false));
     $context = new Context($session, $request, $setup);
     if ($context->is_api_request()) {
         (new Api($context))->apply();
     } else {
         if ($context->is_info_request()) {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             require __DIR__ . '/pages/info.php';
         } else {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             $fallback_html = (new Fallback($context))->get_html();
             require __DIR__ . '/pages/index.php';
         }
     }
 }
开发者ID:arter97,项目名称:h5ai,代码行数:26,代码来源:class-bootstrap.php

示例8: runLiveUpdate

 /**
  * Run the Live Update
  * @param \BackendTemplate
  */
 protected function runLiveUpdate(\BackendTemplate $objTemplate)
 {
     $archive = 'system/tmp/' . \Input::get('token');
     // Download the archive
     if (!file_exists(TL_ROOT . '/' . $archive)) {
         $objRequest = new \Request();
         $objRequest->send(\Config::get('liveUpdateBase') . 'request.php?token=' . \Input::get('token'));
         if ($objRequest->hasError()) {
             $objTemplate->updateClass = 'tl_error';
             $objTemplate->updateMessage = $objRequest->response;
             return;
         }
         \File::putContent($archive, $objRequest->response);
     }
     $objArchive = new \ZipReader($archive);
     // Extract
     while ($objArchive->next()) {
         if ($objArchive->file_name != 'TOC.txt') {
             try {
                 \File::putContent($objArchive->file_name, $objArchive->unzip());
             } catch (\Exception $e) {
                 $objTemplate->updateClass = 'tl_error';
                 $objTemplate->updateMessage = 'Error updating ' . $objArchive->file_name . ': ' . $e->getMessage();
                 return;
             }
         }
     }
     // Delete the archive
     $this->import('Files');
     $this->Files->delete($archive);
     // Run once
     $this->handleRunOnce();
 }
开发者ID:iCodr8,项目名称:core,代码行数:37,代码来源:LiveUpdate.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $room_type = new RoomType($request->all());
     $room_type->save();
     return $room_type;
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:13,代码来源:RoomTypeController.php

示例10: handler

 /**
  * package serverを立ち上げる
  *
  * @param string $package_root パッケージ名
  */
 public static function handler($package_root = null)
 {
     if (empty($package_root) || Rhaco::path() == "") {
         $debug = debug_backtrace();
         $first_action = array_pop($debug);
         if ($package_root === null) {
             $package_root = basename(dirname($first_action["file"]));
         }
         if (Rhaco::path() == "") {
             Rhaco::init($first_action["file"]);
         }
     }
     $base_dir = Rhaco::path();
     $request = new Request();
     $package_root_path = str_replace(".", "/", $package_root);
     $preg_quote = (empty($package_root_path) ? "" : preg_quote($package_root_path, "/") . "\\/") . "(.+)";
     $tag = new Tag("rest");
     if (preg_match("/^\\/state\\/" . $preg_quote . "\$/", $request->args(), $match)) {
         $tag->add(new Tag("package", $match[1]));
         if (self::parse_package($package_root_path, $base_dir, $match[1], $tgz_filename)) {
             $tag->add(new Tag("status", "success"));
             $tag->output();
         }
     } else {
         if (preg_match("/^\\/download\\/" . $preg_quote . "\$/", $request->args(), $match)) {
             if (self::parse_package($package_root_path, $base_dir, $match[1], $tgz_filename)) {
                 Http::attach(new File($tgz_filename));
             }
         }
     }
     Http::status_header(403);
     $tag->add(new Tag("status", "fail"));
     $tag->output();
     exit;
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:40,代码来源:Packager.php

示例11: add

 /**
  * add a new request to the pool.
  */
 public function add(Request $request, array $opts = array())
 {
     $ch = $request->build($opts);
     $this->requests[(int) $request->resource] = $request;
     curl_multi_add_handle($this->resource, $request->resource);
     return $request;
 }
开发者ID:Gaia-Interactive,项目名称:gaia_core_php,代码行数:10,代码来源:pool.php

示例12: testJSONRequestIsConvertedToConvertedBodyRequest

 public function testJSONRequestIsConvertedToConvertedBodyRequest()
 {
     $request = new Request(Request::POST, '/entities/something/1');
     $request->setHeaderField('Content-Type', 'application/json')->setBody('{"some": "value"}');
     $serviceRequest = $this->requestConverter->fromHTTPRequest($request);
     $this->assertEquals((object) array('some' => 'value'), $serviceRequest->getBody());
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:7,代码来源:RequestConverterTest.php

示例13: onAction

 /**
  *
  */
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $SessionPost = array();
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     switch ($SessionPost["ViewState"]["FormSubmitValue"]) {
         case "save":
             $SessionPost["ViewState"]["ErrorsArray"] = array();
             if (empty($SessionPost["ModuleName"]) == true || trim($SessionPost["ModuleName"]) == '') {
                 $SessionPost["ViewState"]["ErrorsArray"][] = "MODULE_ERROR_NO_NAME";
             }
             $nErrors = sizeof($SessionPost["ViewState"]["ErrorsArray"]);
             if ($nErrors == 0) {
                 unset($SessionPost["ViewState"]["ErrorsArray"]);
                 $this->saveDataToDB($SessionPost);
                 $SessionPost["ViewState"]["hasCloseScript"] = "true";
             }
             break;
         default:
             _fatal(array("CODE" => "CORE_051"), __CLASS__, __FUNCTION__, $request->getValueByKey('FormSubmitValue'));
             break;
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     // get view name by action name.
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
开发者ID:digitaldevelopers,项目名称:plugin-avactis-2.1,代码行数:35,代码来源:update_wtp.php

示例14: testGenerateUri

 public function testGenerateUri()
 {
     $request = new Request();
     $request->pattern('test/<action>');
     $params = array('action' => 'index');
     $this->assertSame('test/index', $request->generate_uri($params));
 }
开发者ID:jlipinio,项目名称:MVC-test,代码行数:7,代码来源:RequestTest.php

示例15: __construct

 public function __construct(Request $peticion)
 {
     global $debugbar;
     $app = $peticion->getControlador();
     $apps = new AppsBuilder(require __DIR__ . '/Config/aplications.php');
     $this->app = new \Elephant\Bootstrap\AppBuilder($apps->getAppName($app));
 }
开发者ID:elephantphp,项目名称:ElephantFreamwork,代码行数:7,代码来源:Bootstrap.php


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