如何从Smarty中的URL获取最后一个值 [英] How to get the last value from url in smarty

查看:96
本文介绍了如何从Smarty中的URL获取最后一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从smarty中的给定URL中获取最后一个值

I need to get the last value from the given url in smarty

My url : http://localhost/htdocs/cscart_mutli_car/electronics/computers/desktops/

I need to get "desktops" from the above url


中获取桌面

我该怎么做。请帮助我。

How can i do that . Please help me.

推荐答案

请尝试

{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}

这篇关于如何从Smarty中的URL获取最后一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆