0
$uploader->setFilesDispersion(false);
$uploader->save($path, $fname); //save the file on the specified path
$post['simagepath'] = $fname;
  }
} catch (Exception $e) {
Mage::getSingleton('core/session')->addError($e->getMessage() . " please upload only valid extension file: jpg, png, gif, jpeg");
$this->_redirect('advert/banner/list');
//echo "test";                
}
die("hello");
Mage::getModel('advert/advert')->saveAdvert($post);
$this->_redirect('advert/banner/list');

上面的代码只是代码的一部分,而不是完整的代码。在这段代码中,catch 块重定向功能不起作用,任何人都可以帮助我为什么它在 magento 中不起作用。

4

1 回答 1

4

这段代码在哪里?如果这是在控制器中,很可能您需要立即return;退出$this->_redirect('advert/banner/list');代码,然后重定向将/应该执行。

于 2013-04-09T12:02:07.517 回答