dte49889 2011-02-12 11:57
浏览 77

PHP substr查询 - 裁剪URL

I currently have the string: "/en/sports/football/"

How do I substr this string to achieve:

"/sports/football/"

Many thanks for any pointers.

  • 写回答

2条回答 默认 最新

  • dssj88098 2011-02-12 12:01
    关注

    Well, lets take a look: http://php.net/manual/en/function.substr.php

    The method signature looks something like this:

    string substr ( string $string , int $start [, int $length ] )

    If length is omitted, the substring starting from start until the end of the string will be returned.

    So I guess we could do something like this to get characters 3 and onward.

    substr("/en/sports/football/", 3);

    评论

报告相同问题?

悬赏问题

  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失