我正在为用户注册添加电子邮件验证步骤。我似乎无法访问通过电子邮件链接传递的参数;
link:activation.php?email=someone@somewhere.com& key = 5614c46be05a95f55f2231d8dea41418d17b197a
这是页面代码;
class page_activation extends Page {
function init(){
parent::init();
if($this->api->auth->isLoggedIn())$this->api->redirect('index');
$loginAccount = $_GET['email'];
$activationKey = $_GET['key'];
$this->add('H1')->set('Activated');
$this->add('H3')->set('Account: '.$loginAccount);
$this->add('H3')->set('Key: '.$_GET['key']);
}
答案 0 :(得分:0)
var_dump($_GET);
答案 1 :(得分:0)
我找到了一个可以帮助某人的解决方案。您似乎可以访问$ _SERVER变量,但是当您到达页面时$ _GET变量将丢失。以下是我用来访问电子邮件链接中传递的变量的一些代码;
class page_activation extends Page {
function init(){
parent::init();
if($this->api->auth->isLoggedIn())$this->api->redirect('index');
$data = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
$queryParts = split('[;&]', $data);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
$loginAccount = $params['email'];
$activationKey = $params['key'];
$this->add('H1')->set('Activated');
$this->add('H3')->set('Account: '.$loginAccount);
$this->add('H3')->set('Key: '.$activationKey);
}
}