我在 customscript.php 目录中创建了一个名为 /shell 的脚本。
此脚本扩展 Mage_Shell_Abstract

当我在这个脚本中使用 getUrl() 时,Magento 在 URL 中添加了 customscript.php

如果我做:

Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array('order_id' => 123));

我有:
http://mysite.com/customscript.php/admin/sales_order/view/order_id/123/key/{secret key}

如何在不使用 customscript.php 结果的情况下从 URL 中删除 str_replace()

最佳答案

您可以为 getUrl() 函数使用 '_type' 参数,如下所示:

Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array(
  'order_id' => 123,
  '_type' => Mage_Core_Model_Store::URL_TYPE_WEB
));

关于shell - 在 Magento shell 脚本中使用 getUrl,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18765290/

10-12 01:05