使用Mage :: getUrl()数组参数(Use of Mage::getUrl() array parameter)

编程入门 行业动态 更新时间:2024-10-25 20:17:14
使用Mage :: getUrl()数组参数(Use of Mage::getUrl() array parameter)

在我以前这样做之前:

$response['url'] = Mage::getBaseUrl() .'module/controller/action?sku=' . $request['sku'] . '&qty=';

现在我需要使用::getUrl() ,但我似乎无法理解如何使用保留的特殊值( 这里的教程 )。

所以现在我这样做:

$response['url'] = Mage::getUrl('module/controller/action', array('sku_query' => $item['sku'], 'qty_query' => ''));

我的url字符串如下: ...module/controller/action/sku_query/skuValue/而不是? 和&用于GET查询字符串。 而且qty也不见了......

然而,我希望它看起来像...module/controller/action?sku=skuValue&qty=


调试器的屏幕截图,用于检查url的值:

代码如何看起来:

Mage::getUrl('orderbysku/producttype/showpopupinproductviewpage', array('_query' => 'sku='.$item['sku'].'&qty='))

Before I used to do this:

$response['url'] = Mage::getBaseUrl() .'module/controller/action?sku=' . $request['sku'] . '&qty=';

Now I am required to use ::getUrl(), but I can't seem to understand how to make use of the reserved special values (tutorial here).

So now I do this:

$response['url'] = Mage::getUrl('module/controller/action', array('sku_query' => $item['sku'], 'qty_query' => ''));

and my url string comes out like this: ...module/controller/action/sku_query/skuValue/ instead of with ? and & for the GET query strings. And also the qty is missing...

Whereas, I want it to look like ...module/controller/action?sku=skuValue&qty=


Screenshot from the debugger, to check the value of the url:

How the code looks:

Mage::getUrl('orderbysku/producttype/showpopupinproductviewpage', array('_query' => 'sku='.$item['sku'].'&qty='))

最满意答案

这应该是诀窍:

Mage::getUrl( 'module/controller/action', array('_query' => 'sku=' . $item['sku'] . '&qty=') );

This should do the trick:

Mage::getUrl( 'module/controller/action', array('_query' => 'sku=' . $item['sku'] . '&qty=') );

更多推荐

本文发布于:2023-08-06 16:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1454028.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   参数   getUrl   Mage   array

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!