0

我有以下查询字符串:

 [QUERY_STRING] => u=http%3A%2F%2Fnews.yahoo.com%2Fblogs%2Fsideshow%2Fman-fathered-30-kids-needs-break-child-support-140439765.html&t=%3Cp%20id=%22yui_3_4_0_22_1337372504263_287%22%3EAnd%20you%20thought%20Octomom%20had%20her%20hands%20full%E2%80%94a%20Tennessee%20man%20who%20has%20fathered%2030%20children%20is%20asking%20the%20courts%20for%20a%20break%20on%20child%20support.%3C/p%3E%0A%3Cp%20id=%22yui_3_4_0_22_1337372504263_286%22%3EDesmond%20Hatchett,%2033,%20of%20Knoxville%20has%20children%20with%2011%20different%20women,%20%3Ca%20href=%22http://wreg.com/2012/05/16/tn-man-fathers-30-kids-but-cant-support-any/%22%20target=%22_blank%22%3Ereports%20WREG-TV%3C/a%3E.%3C/p%3E%0A%3Cp%20id=%22yui_3_4_0_22_1337372504263_285%22%3EThe%20state%20already%20takes%20half%20his%20paycheck%20and%20divides%20it%20up,%20which%20doesn%27t%20amount%20to%20much%20when%20Hatchett%20is%20making%20only%20minimum%20wage.%20Some%20of%20the%20moms%20receive%20as%20little%20as%20$1.49%20a%20month.%20The%20oldest%20child%20is%2014%20years%20old.%3C/p%3E%0A%3Cp%20id=%22yui_3_4_0_22_1337372504263_284%22%3EHatchett%20explains%20how%20he%20reached%20such%20a%20critical%20mass:%20He%20had%20four%20kids%20in%20the%20same%20year.%20Twice.%3C/p%3E%0A%3Cp%20id=%22yui_3_4_0_22_1337372504263_283%22%3E%3Ca%20href=%22http://www.youtube.com/watch?v=RTZk1y8iaho%22%20target=%22_blank%22%20id=%22yui_3_4_0_22_1337372504263_308%22%3EBack%20in%202009%20when%20Hatchett%20%3C/a%3Ewas%20in%20court%20to%20answer%20charges%20that%20many%20of%20the%20mothers%20were%20not%20receiving%20child%20support,%20he%20had%2021%20children.%20At%20the%20time,%20he%20said%20he%20was%20not%20going%20to%20father%20any%20more%20kids,%20but%20he%20ended%20up%20having%20nine%20more%20in%20the%20past%20three%20years.%3C/p%3E%0A%3Cp%20id=%22yui_3_4_0_22_1337372504263_282%22%3EThe%20state%20cannot%20order%20Hatchett%20to%20stop%20making%20babies.%20He%20hasn%27t%20broken%20any%20laws,%20according%20to%20the%20report.%3C/p%3E

但是,我的 $_GET 数组中唯一的内容如下:

 [u] => http://news.yahoo.com/blogs/sideshow/man-fathered-30-kids-needs-break-child-support-140439765.html

我的 get 请求少于 2k 个字符,服务器收到了整个字符串,所以我不知道会发生什么。

4

2 回答 2

1

试试这个:

print_r($_GET);

就我而言,使用相同的查询字符串我得到了这个结果:

Array
(
    [u] => http://news.yahoo.com/blogs/sideshow/man-fathered-30-kids-needs-break-child-support-140439765.html
    [t] => <p id="yui_3_4_0_22_1337372504263_287">And you thought Octomom had her hands full—a Tennessee man who has fathered 30 children is asking the courts for a break on child support.</p>
<p id="yui_3_4_0_22_1337372504263_286">Desmond Hatchett, 33, of Knoxville has children with 11 different women, <a href="http://wreg.com/2012/05/16/tn-man-fathers-30-kids-but-cant-support-any/" target="_blank">reports WREG-TV</a>.</p>
<p id="yui_3_4_0_22_1337372504263_285">The state already takes half his paycheck and divides it up, which doesn't amount to much when Hatchett is making only minimum wage. Some of the moms receive as little as $1.49 a month. The oldest child is 14 years old.</p>
<p id="yui_3_4_0_22_1337372504263_284">Hatchett explains how he reached such a critical mass: He had four kids in the same year. Twice.</p>
<p id="yui_3_4_0_22_1337372504263_283"><a href="http://www.youtube.com/watch?v=RTZk1y8iaho" target="_blank" id="yui_3_4_0_22_1337372504263_308">Back in 2009 when Hatchett </a>was in court to answer charges that many of the mothers were not receiving child support, he had 21 children. At the time, he said he was not going to father any more kids, but he ended up having nine more in the past three years.</p>
<p id="yui_3_4_0_22_1337372504263_282">The state cannot order Hatchett to stop making babies. He hasn't broken any laws, according to the report.</p>
)

第二个值在那里。

也许是你的 php.ini 配置。

- suhosin.get.max_name_length (默认: 64) 为通过 URL 注册的变量定义变量名称的最大长度。对于数组变量,这是索引前面的名称。

- suhosin.get.max_totalname_length(默认值:256) 定义通过 URL 注册时总变量名称的最大长度。对于数组变量,这包括所有索引。

- suhosin.get.max_value_length(默认值:512) 定义通过 URL 注册的变量的最大长度。

伟大的。

于 2012-05-18T20:47:22.150 回答
0

如果您仔细查看查询字符串,您将找到问题的原因。

.....140439765.html&t=%3Cp%20id=....

仔细查看&html 扩展名之后的内容。在将其传递给您的 php 脚本之前,您需要在整个 url 中使用urlencode 。

$link='http://news.yahoo.com/blogs/sideshow/man-fathered-30-kids-needs-break-child-support-140439765.html&t=<p id="yui_3_4_0_22_1337372504263_287">And you thought Octomom had her hands fulla Tennessee man who has fathered 30 children is asking the courts for a break on child support.</p><p id="yui_3_4_0_22_1337372504263_286">Desmond Hatchett, 33, of Knoxville has children with 11 different women, <a href="http://wreg.com/2012/05/16/tn-man-fathers-30-kids-but-cant-support-any/" target="_blank">reports WREG-TV</a>.</p><p id="yui_3_4_0_22_1337372504263_285">The state already takes half his paycheck and divides it up, which doesn\'t amount to much when Hatchett is making only minimum wage. Some of the moms receive as little as .49 a month. The oldest child is 14 years old.</p><p id="yui_3_4_0_22_1337372504263_284">Hatchett explains how he reached such a critical mass: He had four kids in the same year. Twice.</p><p id="yui_3_4_0_22_1337372504263_283"><a href="http://www.youtube.com/watch?v=RTZk1y8iaho" target="_blank" id="yui_3_4_0_22_1337372504263_308">Back in 2009 when Hatchett </a>was in court to answer charges that many of the mothers were not receiving child support, he had 21 children. At the time, he said he was not going to father any more kids, but he ended up having nine more in the past three years.</p><p id="yui_3_4_0_22_1337372504263_282">The state cannot order Hatchett to stop making babies. He hasn\'t broken any laws, according to the report.</p>';
echo '<a href="script.php?u=' . urlencode($link) . '">The link title</a>'

那应该行得通。

于 2012-05-18T21:02:57.957 回答