【发布时间】:2017-12-07 07:15:05
【问题描述】:
我有一个字符串示例
this-is-the-example/exa
我想从上面的行中修剪 /exa
$string1 = "this-is-the-example/exa";
$string2 = "/exa";
我正在使用rtrim($string1, $sting2)
但是输出是this-is-the-exampl
我想this-is-the-example 作为输出。
这两个字符串都是动态的,并且可能在字符串中出现多次。但我只想删除最后一部分。 string2 中包含/ 也不是强制性的。这也可能是普通字符串。像a,abc 也一样..
【问题讨论】: