How to get the last value from url in smarty

梦想的初衷 提交于 2020-01-06 12:54:08

问题


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.


回答1:


Please try

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


来源:https://stackoverflow.com/questions/28146678/how-to-get-the-last-value-from-url-in-smarty

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!