我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在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.

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}

近期文章

  • 打开txt文件并相应地将其内容插入表中
  • Codeigniter:表单验证不在控制器中工作
  • 按下编辑按钮时无法保持选择的下拉值
  • 跟踪任务所需的总时间
  • 在apache web服务器中使用php集成python代码,而不使用exec命令
  • zend框架中的jquery插件
  • 如何创建yii2多个字段? [关闭]
  • 带有PHP数组的Morris.js图表
  • 运行Cron.php时出现Magento错误
  • 多个require_once和活动文件夹
  • 在SQL注入时,cakephp验证失败
  • 如何使用php和mysql创建xml文件? [重复]
  • 我正在android中创建一个注册页面
  • SocketIO Nodejs和PHP,如何使其工作?
  • Google云端硬盘上的主机资源,循环显示
  • 循环MySQL并使用PHP添加点
  • 用户登录后将立即提交用户表单
  • 如何使用PHP编辑html页面中的div和meta标签
  • 会话:让Page2.php在刷新时显示404错误
  • 在所有标记(如<a>)之前插入其他html标记

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华