PHP GET错误返回null

时间:2016-12-29 16:11:51

标签: php get

错误网址GET http://xxxx/getSoru.php?notin=66733,17234,65585,16126,1790,45282,2522504,36297,66733,17234,65585,16126,45282,25613,44739,43419,19521,49195,34736,59717,3701,11671,24810,12358,66733,17234,65585,16126,1790,45282,25613,27092,60758,21701,44739,54036,20215,63234,59201,43419,19521,49195,34736,59717,3701,11671,24810,12358,19600,67182,47380,43313,4421,44779,32417,39457,48284,19056,35821,11085,12306,22573,12131,19561,61720,3923,43192,28483,8768,26383,3758,54901,32784,1109,6860,36101,375,1547,16996,15377,37769,5248,8171,25155,49890,8658,22504,36297

无错误网址GET http://xxxx/getSoru.php?notin=66733,17234,65585,16126,1790,45282,2522504,36297,66733,17234,65585,16126,45282,25613,44739,43419,19521,49195,34736,59717,3701,11671,24810,12358,66733,17234,65585,16126,1790,45282,25613,27092,60758,21701,44739,54036,20215,63234,59201,43419,19521,49195,34736,59717,3701,11671,24810,12358,19600,67182,47380,43313,4421,44779,32417,39457,48284,19056,35821,11085,12306,22573,12131,19561,61720,3923,43192,28483,8768,26383,3758,54901,32784,1109,6860,36101,375,1547,16996,15377,37769,5248,8171,25155,49890,8658,22504

删除网址中的36297号码或任何号码都没问题 getSoru.php文件

<?php
$notin = $_GET['notin'];
echo $notin;
?>

我没有收到414 Request-URI Too Long错误

为什么返回空?

1 个答案:

答案 0 :(得分:2)

如果您urlencode() 无错误网址字符串,则会收到以下信息:

66733%2C17234%2C65585%2C16126%2C1790%2C45282%2C2522504%2C36297%2C66733%2C17234%2C65585%2C16126%2C45282%2C25613%2C44739%2C43419%2C19521%2C49195%2C34736%2C59717%2C3701%2C11671%2C24810%2C12358%2C66733%2C17234%2C65585%2C16126%2C1790%2C45282%2C25613%2C27092%2C60758%2C21701%2C44739%2C54036%2C20215%2C63234%2C59201%2C43419%2C19521%2C49195%2C34736%2C59717%2C3701%2C11671%2C24810%2C12358%2C19600%2C67182%2C47380%2C43313%2C4421%2C44779%2C32417%2C39457%2C48284%2C19056%2C35821%2C11085%2C12306%2C22573%2C12131%2C19561%2C61720%2C3923%2C43192%2C28483%2C8768%2C26383%2C3758%2C54901%2C32784%2C1109%2C6860%2C36101%2C375%2C1547%2C16996%2C15377%2C37769%2C5248%2C8171%2C25155%2C49890%2C8658%2C22504

如果您使用echo $_GET['notin']在URL中传递此内容,则会显示字符串数为507的正确值:

66733,17234,65585,16126,1790,45282,2522504,36297,66733,17234,65585,16126,45282,25613,44739,43419,19521,49195,34736,59717,3701,11671,24810,12358,66733,17234,65585,16126,1790,45282,25613,27092,60758,21701,44739,54036,20215,63234,59201,43419,19521,49195,34736,59717,3701,11671,24810,12358,19600,67182,47380,43313,4421,44779,32417,39457,48284,19056,35821,11085,12306,22573,12131,19561,61720,3923,43192,28483,8768,26383,3758,54901,32784,1109,6860,36101,375,1547,16996,15377,37769,5248,8171,25155,49890,8658,22504

如果您使用以下内容对错误网址执行相同操作,则会得到 513 的字符串计数,这意味着如果suhosin修补程序超过默认字符数限制已安装。

66733%2C17234%2C65585%2C16126%2C1790%2C45282%2C2522504%2C36297%2C66733%2C17234%2C65585%2C16126%2C45282%2C25613%2C44739%2C43419%2C19521%2C49195%2C34736%2C59717%2C3701%2C11671%2C24810%2C12358%2C66733%2C17234%2C65585%2C16126%2C1790%2C45282%2C25613%2C27092%2C60758%2C21701%2C44739%2C54036%2C20215%2C63234%2C59201%2C43419%2C19521%2C49195%2C34736%2C59717%2C3701%2C11671%2C24810%2C12358%2C19600%2C67182%2C47380%2C43313%2C4421%2C44779%2C32417%2C39457%2C48284%2C19056%2C35821%2C11085%2C12306%2C22573%2C12131%2C19561%2C61720%2C3923%2C43192%2C28483%2C8768%2C26383%2C3758%2C54901%2C32784%2C1109%2C6860%2C36101%2C375%2C1547%2C16996%2C15377%2C37769%2C5248%2C8171%2C25155%2C49890%2C8658%2C22504%2C36297

我怀疑您安装了suhosin补丁,因此您需要通过更改PHP.ini中的以下内容来扩展此限制:

suhosin.get.max_value_length = <limit>

见:

http://php.net/manual/en/reserved.variables.get.php