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


PHP HTTPRequest::getVar方法代码示例

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


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

示例1: filter

 /**
  * Action to render results for an autocomplete filter.
  *
  * @param HTTPRequest $request
  * @return void
  */
 function filter($request)
 {
     //$model = singleton($this->modelClass);
     $context = $this->dataObject->getDefaultSearchContext();
     $value = $request->getVar('q');
     $results = $context->getResults(array("Name" => $value));
     header("Content-Type: text/plain");
     foreach ($results as $result) {
         echo $result->Name . "\n";
     }
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:17,代码来源:ScaffoldingComplexTableField.php

示例2: confirm

 /**
  * Allows the user to confirm their account by clicking on the validation link in
  * the confirmation email.
  *
  * @param  HTTPRequest $request
  * @return array
  */
 public function confirm($request)
 {
     if (Member::currentUser()) {
         return Security::permissionFailure($this, _t('MemberProfiles.CANNOTCONFIRMLOGGEDIN', 'You cannot confirm account while you are logged in.'));
     }
     if ($this->EmailType != 'Validation' || !($id = $request->param('ID')) || !($key = $request->getVar('key')) || !is_numeric($id) || !($member = DataObject::get_by_id('Member', $id))) {
         $this->httpError(404);
     }
     if ($member->ValidationKey != $key || !$member->NeedsValidation) {
         $this->httpError(403, 'You cannot validate this member.');
     }
     $member->NeedsValidation = false;
     $member->ValidationKey = null;
     $member->write();
     $member->logIn();
     return array('Title' => $this->obj('ConfirmationTitle'), 'Content' => $this->obj('ConfirmationContent'));
 }
开发者ID:SilbinaryWolf,项目名称:silverstripe-memberprofiles,代码行数:24,代码来源:MemberProfilePage.php


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