普通网友 2013-04-24 16:10
浏览 56

Magento在主网址后获取网址

I have looked all over the internet, but can not find the following answer:

We want to get the part in Magento in .phtml after the main url so if:

domain.com/shoes.html we want to get only shoes.html

This is important because we have a multishop in .nl and .be and we want to use the hreflang. We need to give in both shops the url of both shops so as well from the .be and the .nl and then with the subcategory or product url.

In .phtml you can get the current url with: helper('core/url')->getCurrentUrl();?>

With that code you will get the total url so domain.com/shoes.html and we only want the part shoes.html

Would be great if someone knows the answer

  • 写回答

5条回答 默认 最新

  • douzhi4991 2013-04-24 16:24
    关注

    You can get that filename by using PHP's basename method

    $url = Mage::helper('core/url')->getCurrentUrl(); //http://domain.com/shoes.html
    echo basename($url); //outputs shoes.html
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看