【发布时间】:2013-02-21 15:26:19
【问题描述】:
我在将 URL 作为 GET 参数传递时遇到了一些问题。当我尝试访问时:
http://www.linkebuy.com.br/linkebuy/parceiro?url=http%3A%2F%2Fwww.google.com
我收到以下消息:
但是,如果我选择:
http://www.linkebuy.com.br/linkebuy/parceiro?url=123
一切正常(它重定向到一个不存在的站点 - 123 - 当然,但它符合预期)。通过排除,我可以说url 参数有问题,但它是什么?
OBS:我正在使用rawurlencode() 对网址进行编码。
编辑: 你问的代码...
在第一个视图中,链接所在的位置 (http://www.linkebuy.com.br/notebook/detalhe?id=5):
<!-- url() function just completes the right URL (production or development) -->
<a href="<?php echo url('linkebuy/parceiro/?url=' . rawurlencode($l->getUrl()), true) ?>" class="<?php echo $leadClass ?> oferta" target="_blank">
<?php echo $l->getNomeFantasia() ?>
</a>
当点击链接时,会重定向到一个动作 (/linkebuy/parceiro),会发生以下情况(基本上没有,只是保留在框架中):
public function execute($request, $response) {
$response->addParameter('url', rawurldecode($request->getParameter('url', ''))); //This creates $url in the view
$response->setTemplate('site/linkebuy/lead-parceiro.php'); //Forwards to the view
}
它包括视图lead-parceiro.php(在问题上方,我链接到此页面),其中头部包含:
<script type="text/javascript">
setInterval(function(){ window.location = '<?php echo $url ?>'; },3000);
</script>
【问题讨论】:
-
使用简单的
urlencode()并告诉我们这是否有任何不同。 -
完全没有区别。
-
问题出在您的重定向功能中......向我们展示代码;)
-
http%3A%2F%2Fgoogle.com是 urlencoded -
我认为可能是 apache 配置限制不允许在您的查询字符串中包含 http://
标签: php apache url parameters get