问题描述
我有一个看起来像这样的网址 reg.php?lang=no_NO&passkey=test 我正在尝试获取密码变量,但它一直显示为空白.
I have a url that look like this reg.php?lang=no_NO&passkey=testand im trying to get the passkey variable, but it keeps showing up blank.
当我尝试 print_r($_GET); 它打印 Array ( ) ?!怎么会这样?
When I try print_r($_GET); it prints Array ( ) ?! How can this happen?
网站看起来像这样
<?php
print_r($_GET);
include('..libsSmarty.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('templatessite.tpl');
?>
</body>
</html>
就是这样.我不明白为什么 $_GET 显示为空白.它已经让我发疯了一段时间了..
thats it. I can't understand why $_GET shows up blank. It's been driving me crazy for a while now..
推荐答案
当我遇到这样的问题时,我总是将我的脚本归结为基础.在脚本的最顶部试试这个:
When I run into something that stumps me like this, I always take my script right down to basics. Try this at the very top of your script:
var_dump($_GET);
exit;
然后您可以查看它是否实际上是从钩子中获取变量.如果没有,那么可能有更深层次的东西……比如 PHP 真的与 Apache 一起运行吗?如果它有效,开始添加其他东西,直到它再次停止,你就可以开始缩小罪魁祸首的范围.
Then you can see if in fact it is getting the vars from the hook. If not, then there may be something deeper... like is PHP really running with Apache? If it works, start adding in other things until it stops again and you can start narrowing down the culprit.
这篇关于当 url 有变量时 $_GET 为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)