如何在smarty中从url获取最后一个值

时间:2015-01-26 08:24:32

标签: php smarty cs-cart

我需要从smarty

中的给定网址获取最后一个值
My url : http://localhost/htdocs/cscart_mutli_car/electronics/computers/desktops/

I need to get "desktops" from the above url

我该怎么做?请帮帮我。

1 个答案:

答案 0 :(得分:0)

请尝试

{assign var="last_dir" value="/"|explode:$smarty.server.REQUEST_URI}
{assign var="last_key" value=$last_dir|count}
{assign var="last_dir" value=$last_dir[$last_key-2]}
{$last_dir}