本文整理汇总了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";
}
}
示例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'));
}