问题
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