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


PHP Request::set方法代码示例

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


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

示例1: signRequest

 /**
  * Sign request with private key
  * 
  * @param Request request
  */
 function signRequest(Request $request)
 {
     $request->set('clientId', $this->clientId);
     $params = $request->getParameters();
     ksort($params);
     $token = $this->privateKey;
     foreach ($params as $key => $value) {
         $token .= $key . $value;
     }
     $request->set('hash', hash('sha256', $token));
 }
开发者ID:getfivestars,项目名称:php-sdk,代码行数:16,代码来源:AuthToken.php

示例2: testSetParam

 public function testSetParam()
 {
     Request::set('yyy', 'xyzzy');
     Request::set('zzz', array(1, 2));
     $this->assertSame(Request::get('yyy'), 'xyzzy');
     $this->assertSame(Request::getArray('zzz'), array(1, 2));
 }
开发者ID:ratbird,项目名称:hope,代码行数:7,代码来源:RequestTest.php

示例3: before_filter

 function before_filter(&$action, &$args)
 {
     if (Request::option('auswahl')) {
         Request::set('cid', Request::option('auswahl'));
     }
     parent::before_filter($action, $args);
     checkObject();
     $this->institute = Institute::findCurrent();
     if (!$this->institute) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     }
     $this->institute_id = $this->institute->id;
     //set visitdate for institute, when coming from meine_seminare
     if (Request::option('auswahl')) {
         object_set_visit($this->institute_id, "inst");
     }
     //gibt es eine Anweisung zur Umleitung?
     if (Request::get('redirect_to')) {
         $query_parts = explode('&', stristr(urldecode($_SERVER['QUERY_STRING']), 'redirect_to'));
         list(, $where_to) = explode('=', array_shift($query_parts));
         $new_query = $where_to . '?' . join('&', $query_parts);
         page_close();
         $new_query = preg_replace('/[^:0-9a-z+_\\-.#?&=\\/]/i', '', $new_query);
         header('Location: ' . URLHelper::getURL($new_query, array('cid' => $this->institute_id)));
         die;
     }
     PageLayout::setHelpKeyword("Basis.Einrichtungen");
     PageLayout::setTitle($this->institute->getFullName() . " - " . _("Kurzinfo"));
     Navigation::activateItem('/course/main/info');
 }
开发者ID:ratbird,项目名称:hope,代码行数:30,代码来源:overview.php

示例4: send

 public function send()
 {
     Request::post('http://api.postmarkapp.com/email', $this->parseData());
     Request::set(CURLOPT_HTTPHEADER, $this->headers);
     $return = Request::send();
     return isset($return->data) ? $return->data : $return;
 }
开发者ID:CraigChilds94,项目名称:scaffold,代码行数:7,代码来源:postmark.php

示例5: run

 public static function run($routeArgs = [])
 {
     self::$routeArgs = $routeArgs;
     //URL结构处理
     $param = array_filter(explode('/', Request::get(c('http.url_var'))));
     switch (count($param)) {
         case 2:
             array_unshift($param, c('http.default_module'));
             break;
         case 1:
             array_unshift($param, c('http.default_controller'));
             array_unshift($param, c('http.default_module'));
             break;
         case 0:
             array_unshift($param, c('http.default_action'));
             array_unshift($param, c('http.default_controller'));
             array_unshift($param, c('http.default_module'));
             break;
     }
     Request::set('get.' . c('http.url_var'), implode('/', $param));
     $param[1] = preg_replace_callback('/_([a-z])/', function ($matches) {
         return ucfirst($matches[1]);
     }, $param[1]);
     define('MODULE', $param[0]);
     define('CONTROLLER', ucfirst($param[1]));
     define('ACTION', $param[2]);
     define('MODULE_PATH', ROOT_PATH . '/' . c('app.path') . '/' . MODULE);
     define('VIEW_PATH', MODULE_PATH . '/' . 'view');
     define('__VIEW__', __ROOT__ . '/' . c('app.path') . '/' . MODULE . '/view');
     self::action();
 }
开发者ID:houdunwang,项目名称:hdphp,代码行数:31,代码来源:Controller.php

示例6: __construct

 /**
  * Overwritten constructor of the controller. Ensures no cid
  * is present the request.
  *
  * @param Trails_Dispatcher $dispatcher
  */
 public function __construct($dispatcher)
 {
     if (Request::get('cid')) {
         Request::set('cid', null);
     }
     parent::__construct($dispatcher);
 }
开发者ID:ratbird,项目名称:hope,代码行数:13,代码来源:download.php

示例7: offsetUnset

 public function offsetUnset($offset)
 {
     unset($this->array[$offset]);
     foreach ($this->arrays as $array) {
         unset($array[$offset]);
     }
     $this->req->set($offset, null);
 }
开发者ID:ranyuen,项目名称:little,代码行数:8,代码来源:ParameterBag.php

示例8: testGetRequestedActionOkActionFound

  function testGetRequestedActionOkActionFound()
  {
    $resolver = new ActionRequestResolver();

    $request = new Request();
    $request->set('action', $action = 'whatever');

    $this->assertEqual($resolver->resolve($request), $action);
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:ActionRequestResolverTest.class.php

示例9: testControllerWithXmlHttpRequest

 public function testControllerWithXmlHttpRequest()
 {
     $request = new Request();
     $request->set('q', 'Hello');
     $request->setRequestFormat('XmlHttpRequest');
     $ctrl = new SearchController();
     $response = $ctrl->searchAction($request);
     $this->assertEquals('ProductBundle:Search:list.html.twig{"products":{"0":{"name":"foo","description":"A foo product","price":42},"1":{"name":"bar","description":"A bar product","price":23}},"noLayout":true}', $response->getContent());
 }
开发者ID:QafooLabs,项目名称:symfony-testing2,代码行数:9,代码来源:RefactoringTest.php

示例10: testShoudGetParams

 public function testShoudGetParams()
 {
     $_GET = ['city' => 'city A'];
     $this->assertEquals(['paginate' => false, 'page' => 1, 'offset' => $this->object->getDefaultOffset(), 'filter' => ['city' => ['=' => ['city A']]], 'embed' => [], 'sort' => [], 'search' => ''], $this->object->params());
     $this->object->set('add', ['city' => 'city B']);
     $this->assertEquals(['paginate' => false, 'page' => 1, 'offset' => $this->object->getDefaultOffset(), 'filter' => ['city' => ['=' => ['city A', 'city B']]], 'embed' => [], 'sort' => [], 'search' => ''], $this->object->params());
     // passing true should discart changes made with 'set'
     $this->assertEquals(['paginate' => false, 'page' => 1, 'offset' => $this->object->getDefaultOffset(), 'filter' => ['city' => ['=' => ['city A']]], 'embed' => [], 'sort' => [], 'search' => ''], $this->object->params(true));
 }
开发者ID:beeblebrox3,项目名称:Request,代码行数:9,代码来源:RequestTest.php

示例11: send

 public static function send($data)
 {
     // Get the config information
     $pm = Config::get('email.postmark');
     $key = $pm['apiKey'];
     //  Set headers to send to Postmark
     $headers = array('Accept: application/json', 'Content-Type: application/json', 'X-Postmark-Server-Token: ' . $key);
     Request::post('http://api.postmarkapp.com/email', json_encode($data));
     Request::set(CURLOPT_HTTPHEADER, $headers);
     $return = Request::send();
     return $return;
 }
开发者ID:CraigChilds94,项目名称:scaffold,代码行数:12,代码来源:test.php

示例12: route

 public function route(Request $request)
 {
     $parts = explode('/', $request->getServer('REQUEST_URI'));
     unset($parts[0]);
     $controller = array_shift($parts);
     if (!isset($this->values[$controller])) {
         throw new RouterException();
     }
     if (count($parts) % 2 != 0) {
         throw new RouterException();
     }
     $keys = array_keys($parts);
     $count = count($keys);
     for ($i = 0; $i < $count; $i += 2) {
         $request->set($parts[$keys[$i]], $parts[$keys[$i + 1]]);
     }
     return $this->values[$controller];
 }
开发者ID:randyamiel,项目名称:bankaccount,代码行数:18,代码来源:Router.php

示例13: before_filter

 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword("Basis.VeranstaltungenAbonnieren");
     PageLayout::setTitle(_("Veranstaltungssuche"));
     if (Request::option('view')) {
         $_SESSION['sem_portal']['bereich'] = Request::option('view');
     }
     if (!$_SESSION['sem_portal']['bereich']) {
         $_SESSION['sem_portal']['bereich'] = "all";
     }
     Request::set('view', $_SESSION['sem_portal']['bereich']);
     Navigation::activateItem('/search/courses/' . $_SESSION['sem_portal']['bereich']);
     if (Request::option('choose_toplist')) {
         $_SESSION['sem_portal']['toplist'] = Request::option('choose_toplist');
     }
     if (!$_SESSION['sem_portal']['toplist']) {
         $_SESSION['sem_portal']['toplist'] = 4;
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:20,代码来源:courses.php

示例14: index_action

 public function index_action()
 {
     if (Request::option('select_sem_id')) {
         Request::set('cid', Request::option('select_sem_id'));
     }
     PageLayout::setTitle("Teilnehmerverwaltung - " . $this->seminar->getName());
     $this->users = $this->seminar->getMembers('autor');
     $this->tutors = $this->seminar->getMembers('tutor');
     //$this->set_layout('layouts/base.php');
     $this->display = isset($GLOBALS['SessSemName'][1]);
     $this->name = $GLOBALS['SessSemName'][0];
     $this->refered_from_seminar = $_SESSION['links_admin_data']['referred_from'] === 'sem';
     $response = $this->relay("show/searchForm");
     $this->search_form = $response->body;
     global $auth, $perm, $user;
     $this->msg = $msg;
     $this->auth = $auth;
     $this->db = $db;
     $this->user = $user;
 }
开发者ID:anantace,项目名称:Kursadministration,代码行数:20,代码来源:show.php

示例15: loadRequestModel

 public function loadRequestModel(Request $request, $key = '')
 {
     $json = $request->getJSON();
     if ($key) {
         $json = $json[$key];
     }
     $modelReq = new Request();
     $modelReq->setValueArray($json);
     if (!empty($json['attributes']) && is_array($json['attributes'])) {
         foreach ($json['attributes'] as $key => $value) {
             if (!empty($value['valueIDs'])) {
                 foreach (json_decode($value['valueIDs']) as $valueID) {
                     $modelReq->set('specItem_' . $valueID, 'on');
                 }
                 if (!empty($value['newValues'])) {
                     foreach (json_decode($value['newValues']) as $newVal) {
                         $others = $modelReq->get('other', array());
                         $others[$key][] = $newVal;
                         $modelReq->set('other', $others);
                     }
                 }
                 $modelReq->set('removeEmpty_' . $key, 'on');
             } else {
                 if (isset($value['ID'])) {
                     $modelReq->set('specField_' . $key, $value['ID']);
                     if (!empty($value['newValue'])) {
                         $others = $modelReq->get('other', array());
                         $others[$key] = $value['newValue'];
                         $modelReq->set('other', $others);
                     }
                 } else {
                     $modelReq->set('specField_' . $key, $value['value']);
                     foreach (self::getApplication()->getLanguageArray() as $lang) {
                         if (!empty($value['value_' . $lang])) {
                             $modelReq->set('specField_' . $key . '_' . $lang, $value['value_' . $lang]);
                         }
                     }
                 }
             }
         }
     }
     $this->loadRequestData($modelReq);
 }
开发者ID:saiber,项目名称:livecart,代码行数:43,代码来源:ActiveRecordModel.php


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