我在将 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()
对 URL 进行编码。
编辑: 你问的代码......
在第一个视图中,链接在哪里(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>