0

我有一个创建文件的脚本,目前将其放在媒体文件夹中,但我想将它放在媒体/文件中,所以这是我的代码

$filePath = Mage::getBaseDir('media') 。DS .'文件'。'mycsvfile.csv';

$fileName = 'mycsvfile.csv';

        $mageCsv = new Varien_File_Csv();
        $mageCsv->saveData($filePath, $ordersRow);  
        Mage::app()->getFrontController()
                   ->getResponse()
                   ->setRedirect(Mage::helper('adminhtml')->getUrl('mycsvfiles/adminhtml_download/index/', array('file' => $fileName )));
4

1 回答 1

0

我在您的代码中看不到任何错误 - 除了

$filePath = Mage::getBaseDir('media') . DS .'files'. 'mycsvfile.csv';

应该是

$filePath = Mage::getBaseDir('media') . DS .'files'. DS . 'mycsvfile.csv';

因为files是一个目录。您看到的错误可能是在其他地方抛出的。尝试检查您的 etc 部分 .xml 文件 - 指令translate ="label" module =" modulename " 其中modulename是助手别名。前几天我遇到了几个这样的错误。

于 2012-09-12T08:30:25.427 回答