我有一个看起来像这样的网址,reg.php?lang=no_NO&passkey=test我试图获取密钥变量,但它一直显示为空白.
当我尝试print_r($_GET);打印Array ( )?!怎么会发生这种情况?
该网站看起来像这样
<?php
print_r($_GET);
include('..\libs\Smarty.class.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Activate account</title>
(...html code.. )
$smarty = new Smarty;
//$smarty->force_compile = true;
$smarty->debugging = false;
$smarty->caching = false;
$smarty->cache_lifetime = 120;
// PHP gettext api
define('PROJECT_DIR', realpath('./'));
(... define gettext ... )
$passkey=$_GET['passkey'];
(...work with passkey ...)
$smarty->display('templates\site.tpl');
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
而已.我无法理解为什么$ _GET显示空白.它已经让我疯了一段时间了..