PHP中的$ _GET函数无法正常工作

时间:2013-05-19 13:44:39

标签: php

我正在使用此网址:

http://domain.co.uk/iphone/index.php?c=knnKVLO4ROKPvvtxUCDu&bhsirf=Q8IP6OKRtaOCjcCgpb94&9froifhew3=ux9XI0vjKfzieTVS6rTt&40289njgw=We80L1RXDPIQj4ENL3QM&AdjoirtGERG^%%C2%A3fd=ozS60iysc1Vd9QgVDZIP&jorw4958fq%C2%A3$=2kbCk7EXRNMZlYMhDdkhVm2E3j4sNDtmo8ho2Ag6&ffjg^GDDFGn2FFGHe=8fuTCaTzKbf1VYQPcornK8LOK4ERPT43XoegnvTByli9c1rIInTwvwvShxkN&a@@^%45383fhreFGGew=48bFy4U6bBYcMqLHnVfK2kbCk7EXRNMZlYMhDdkh&fGHDFb.fewfrgopewFRWGREG=gbBYKubAEk7DcpQ69M7ZkxVGa2aSWiYlrEXOUqDINYsKnnMhf0hHqhQGdMUS9M3Zy74em2NIrubulwS5XcPmgHytg8we8f1y9aR2&gfiegrowu895743fdGTRY%C2%A3QT%C2%A3%yewhfuigw9545TRWTRYEgsgfnfht34o=vXBuTfXODHxQsHJZH9MQx4TrFZ38eaEmm5eowcKVgeH69YYGWofJQI0Y4jE9GDhFrHdFhMc2Tqtlb4LwWEO47z5IrEp42QppEYMlLzx4yIFlxpNZ3g4gU384DqYPNo9c3Ks2RGGNEVaMhJNewC6g48WHeEhP6r5tfOpI5OyCsNiukHXfoAqVxtaggqt6xkce74hP4f22

然后在我的PHP中:

<?php
if($_GET["c"] == 'knnKVLO4ROKPvvtxUCDu' and $_GET["bhsirf"] == 'Q8IP6OKRtaOCjcCgpb94' and $_GET["9froifhew3"] == 'ux9XI0vjKfzieTVS6rTt' and $_GET["40289njgw"] == 'We80L1RXDPIQj4ENL3QM' and $_GET["AdjoirtGERG^%£fd"] == 'ozS60iysc1Vd9QgVDZIP' and $_GET["jorw4958fq£$"] == '2kbCk7EXRNMZlYMhDdkhVm2E3j4sNDtmo8ho2Ag6' and $_GET["ffjg^GDDFGn2FFGHe"] == '8fuTCaTzKbf1VYQPcornK8LOK4ERPT43XoegnvTByli9c1rIInTwvwvShxkN' and $_GET["a@@^%45383fhreFGGew"] == '48bFy4U6bBYcMqLHnVfK2kbCk7EXRNMZlYMhDdkh' and $_GET["fGHDFb.fewfrgopewFRWGREG"] == 'gbBYKubAEk7DcpQ69M7ZkxVGa2aSWiYlrEXOUqDINYsKnnMhf0hHqhQGdMUS9M3Zy74em2NIrubulwS5XcPmgHytg8we8f1y9aR2' and $_GET["gfiegrowu895743fdGTRY£QT£%yewhfuigw9545TRWTRYEgsgfnfht34o"] == 'vXBuTfXODHxQsHJZH9MQx4TrFZ38eaEmm5eowcKVgeH69YYGWofJQI0Y4jE9GDhFrHdFhMc2Tqtlb4LwWEO47z5IrEp42QppEYMlLzx4yIFlxpNZ3g4gU384DqYPNo9c3Ks2RGGNEVaMhJNewC6g48WHeEhP6r5tfOpI5OyCsNiukHXfoAqVxtaggqt6xkce74hP4f22')
{
    //fine
}
else
{
    header("Location: /iphone/error.php");
}
?>

但即使一切正确,它也会重定向到error.php页面。我的字符串太长还是有其他错误?

继承了$ _GET的var_dump:

errorarray(10) { ["index_php?c"]=> string(20) "knnKVLO4ROKPvvtxUCDu" ["bhsirf"]=> string(20) "Q8IP6OKRtaOCjcCgpb94" ["9froifhew3"]=> string(20) "ux9XI0vjKfzieTVS6rTt" ["40289njgw"]=> string(20) "We80L1RXDPIQj4ENL3QM" ["AdjoirtGERG^%£fd"]=> string(20) "ozS60iysc1Vd9QgVDZIP" ["jorw4958fq£$"]=> string(40) "2kbCk7EXRNMZlYMhDdkhVm2E3j4sNDtmo8ho2Ag6" ["ffjg^GDDFGn2FFGHe"]=> string(60) "8fuTCaTzKbf1VYQPcornK8LOK4ERPT43XoegnvTByli9c1rIInTwvwvShxkN" ["a@@^E383fhreFGGew"]=> string(40) "48bFy4U6bBYcMqLHnVfK2kbCk7EXRNMZlYMhDdkh" ["fGHDFb_fewfrgopewFRWGREG"]=> string(100) "gbBYKubAEk7DcpQ69M7ZkxVGa2aSWiYlrEXOUqDINYsKnnMhf0hHqhQGdMUS9M3Zy74em2NIrubulwS5XcPmgHytg8we8f1y9aR2" ["gfiegrowu895743fdGTRY£QT£%yewhfuigw9545TRWTRYEgsgfnfht34o"]=> string(200) "vXBuTfXODHxQsHJZH9MQx4TrFZ38eaEmm5eowcKVgeH69YYGWofJQI0Y4jE9GDhFrHdFhMc2Tqtlb4LwWEO47z5IrEp42QppEYMlLzx4yIFlxpNZ3g4gU384DqYPNo9c3Ks2RGGNEVaMhJNewC6g48WHeEhP6r5tfOpI5OyCsNiukHXfoAqVxtaggqt6xkce74hP4f22" }

4 个答案:

答案 0 :(得分:1)

发现一个错误:

使用数组中不存在的以下键:

$_GET["fGHDFb.fewfrgopewFRWGREG"]

但这个存在:

$_GET["fGHDFb_fewfrgopewFRWGREG"]

(见Amirs答案的解释)。

此外,$ _GET [“c”]不是有效密钥。不知何故,可能是因为重写规则(正如Michael Berkowski在对你的问题的评论中所建议的那样),它被改为$ _GET [“index_php?c”]。

话虽如此,你的解决方案似乎并不是最优的,因为你冒着遇到这些问题的风险......你究竟想要完成什么?

答案 1 :(得分:1)

  

变量名中的点和空格将转换为下划线。对于   示例<input name="a.b" /> becomes $_GET["a_b"] refer here

答案 2 :(得分:0)

问题可能与运营商优先级and和&amp;&amp;不平等。

我会尝试用and替换&&

答案 3 :(得分:0)

您发布的第一个和第二个代码对我来说似乎没问题,但由于某种原因,您被重定向到错误页面。 用户“Frederik Wordenskjold”说明了您可能希望看到的键是否正常。 我建议解决这个问题或至少弄清楚它在哪里打印你在该文件中收到的每个$ _GET(注释“if-else”语句只是为了测试它)所以你可以意识到问题是在您正在查找的文件中或通过$ _GET

收到的文件中