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


PHP Request::getAllParams方法代码示例

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


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

示例1: testParamManipulation

 /**
  * Test of params
  */
 public function testParamManipulation()
 {
     Request::setParam('foo', 'bar');
     Request::setParam('baz', 'qux');
     $this->assertEquals('bar', Request::getParam('foo'));
     $this->assertEquals('qux', Request::getParam('baz'));
     $this->assertEquals('moo', Request::getParam('qux', 'moo'));
     $this->assertEqualsArray(['foo' => 'bar', 'baz' => 'qux'], Request::getParams());
     $this->assertEqualsArray(['foo' => 'bar', 'baz' => 'qux'], Request::getAllParams());
 }
开发者ID:dezvell,项目名称:mm.local,代码行数:13,代码来源:RequestTest.php

示例2: function

<?php

/**
 *
 *
 * @category Application
 *
 * @author   dark
 * @created  18.12.13 18:39
 */
namespace Application;

use Bluz\Proxy\Request;
return function ($alias) use($module, $controller, $view) {
    /**
     * @var Bootstrap $this
     * @var \Bluz\View\View $view
     */
    var_dump($alias);
    var_dump(Request::getParams());
    var_dump(Request::getAllParams());
    var_dump(Request::getRawParams());
    return false;
};
开发者ID:dezvell,项目名称:skeleton,代码行数:24,代码来源:route-with-other-params.php

示例3: doProcess

 /**
  * Do process
  * @return void
  */
 protected function doProcess()
 {
     Logger::info("app:process:do");
     $module = Request::getModule();
     $controller = Request::getController();
     $params = Request::getAllParams();
     // try to dispatch controller
     try {
         // get reflection of requested controller
         $controllerFile = $this->getControllerFile($module, $controller);
         $reflection = $this->reflection($controllerFile);
         // check header "accept" for catch JSON(P) or XML requests, and switch presentation
         // it's some magic for AJAX and REST requests
         if ($produces = $reflection->getAccept() and $accept = $this->getRequest()->getAccept()) {
             // switch statement for $accept
             switch ($accept) {
                 case Request::ACCEPT_HTML:
                     // with layout
                     // without additional presentation
                     break;
                 case Request::ACCEPT_JSON:
                     $this->useJson();
                     break;
                 case Request::ACCEPT_JSONP:
                     $this->useJsonp();
                     break;
                 case Request::ACCEPT_XML:
                     $this->useXml();
                     break;
                 default:
                     // not acceptable MIME type
                     throw new NotAcceptableException();
                     break;
             }
         }
         // check call method(s)
         if ($reflection->getMethod() && !in_array(Request::getMethod(), $reflection->getMethod())) {
             throw new NotAllowedException(join(',', $reflection->getMethod()));
         }
         // check HTML cache
         if ($reflection->getCacheHtml() && Request::getMethod() == Request::METHOD_GET) {
             $htmlKey = 'html:' . $module . ':' . $controller . ':' . http_build_query($params);
             if ($cachedHtml = Cache::get($htmlKey)) {
                 Response::setBody($cachedHtml);
                 return;
             }
         }
         // dispatch controller
         $dispatchResult = $this->dispatch($module, $controller, $params);
     } catch (RedirectException $e) {
         Response::setException($e);
         if (Request::isXmlHttpRequest()) {
             // 204 - No Content
             Response::setStatusCode(204);
             Response::setHeader('Bluz-Redirect', $e->getMessage());
         } else {
             Response::setStatusCode($e->getCode());
             Response::setHeader('Location', $e->getMessage());
         }
         return null;
     } catch (ReloadException $e) {
         Response::setException($e);
         if (Request::isXmlHttpRequest()) {
             // 204 - No Content
             Response::setStatusCode(204);
             Response::setHeader('Bluz-Reload', 'true');
         } else {
             Response::setStatusCode($e->getCode());
             Response::setHeader('Refresh', '0; url=' . Request::getRequestUri());
         }
         return null;
     } catch (\Exception $e) {
         Response::setException($e);
         // cast to valid HTTP error code
         // 500 - Internal Server Error
         $statusCode = 100 <= $e->getCode() && $e->getCode() <= 505 ? $e->getCode() : 500;
         Response::setStatusCode($statusCode);
         $dispatchResult = $this->dispatch(Router::getErrorModule(), Router::getErrorController(), array('code' => $e->getCode(), 'message' => $e->getMessage()));
     }
     if ($this->hasLayout()) {
         Layout::setContent($dispatchResult);
         $dispatchResult = Layout::getInstance();
     }
     if (isset($htmlKey, $reflection)) {
         // @TODO: Added ETag header
         Cache::set($htmlKey, $dispatchResult(), $reflection->getCacheHtml());
         Cache::addTag($htmlKey, $module);
         Cache::addTag($htmlKey, 'html');
         Cache::addTag($htmlKey, 'html:' . $module);
         Cache::addTag($htmlKey, 'html:' . $module . ':' . $controller);
     }
     Response::setBody($dispatchResult);
 }
开发者ID:Kit-kat1,项目名称:custom-bluz-app,代码行数:97,代码来源:Application.php

示例4: function

<?php

/**
 * Example of forms handle
 *
 * @category Application
 *
 * @author   dark
 * @created  13.12.13 18:12
 */
namespace Application;

use Bluz\Proxy\Layout;
use Bluz\Proxy\Request;
return function ($int, $string, $array, $optional = 0) use($view) {
    /**
     * @var Bootstrap $this
     * @var \Bluz\View\View $view
     */
    Layout::breadCrumbs([$view->ahref('Test', ['test', 'index']), 'Form Example']);
    if (Request::isPost()) {
        ob_start();
        var_dump($int, $string, $array, $optional);
        $view->inside = ob_get_contents();
        ob_end_clean();
        $view->params = Request::getAllParams();
    }
};
开发者ID:dezvell,项目名称:skeleton,代码行数:28,代码来源:form.php


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