重复 URL post 参数问题

Repeated URL post parameters issue

嗨,谁能帮忙解释为什么 URL 字符串参数 post 一次又一次?

HTTP://127.0.0.1/ab/1936.html?cart=yes?cart=yes

当我们在 magneto 1.9 中将产品添加到购物车时,我使用此参数打开迷你购物车

请帮我如何保护这个? 我正在使用这个代码-

<?php
if ($_GET['cart']=='yes') {
    echo "<script type='text/javascript'>
          jQuery('.minicart_open').show();
    </script>";
}
?>

cartController.php

protected function _goBack()
{
    $returnUrl = $this->getRequest()->getParam('return_url');
   // print_r($returnUrl);exit;
    if ($returnUrl) {

        if (!$this->_isUrlInternal($returnUrl)) {
            throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
        }

        $this->_getSession()->getMessages(true);
        $this->getResponse()->setRedirect($returnUrl);
    } elseif (!Mage::getStoreConfig('checkout/cart/redirect_to_cart')
        && !$this->getRequest()->getParam('in_cart')
        && $backUrl = $this->_getRefererUrl()
    ) {
        $this->getResponse()->setRedirect($backUrl.'?cart=yes');
    } else {
        if (
            (strtolower($this->getRequest()->getActionName()) == 'add')
            && !$this->getRequest()->getParam('in_cart')
        ) {
            $this->_getSession()->setContinueShoppingUrl($this->_getRefererUrl());
        }
        $this->_redirect('checkout/cart');
    }
    return $this;
}

我得到了答案

Just replace below line

$this->getResponse()->setRedirect($backUrl.'?cart=yes');

$url = $backUrl; 
        // Search substring  
            if (strpos($url, $key) == false) { 
                 $this->getResponse()->setRedirect($backUrl.'?cart=yes');
            } 
            else { 
                 $this->getResponse()->setRedirect($backUrl);
            } 
            //exit;

它对我有用...希望对您有所帮助...