我想删除Search -我网站上的页面.以下是我的代码示例:
输入:
$search = "Search - echelon";
$trim = "Search - ";
$result = ltrim($search,$trim);
echo $result;
Run Code Online (Sandbox Code Playgroud)
输出:
lon
欲望输出:
echelon
我怎么能这样做,为什么ltrim会在上面的例子中修剪掉更多?谢谢!
RTM.第二个参数被视为要修剪的一组字符.
在这种情况下:
S - in the list, trim it
e - in the list, trim it
a - in the list, trim it
r - in the list, trim it
c - in the list, trim it
h - in the list, trim it
_ - (space) in the list, trim it
- - in the list, trim it
_ - (space) in the list, trim it
e - in the list, trim it
c - in the list, trim it
h - in the list, trim it
e - in the list, trim it
l - NOT in the list, stop!
lon is left
Run Code Online (Sandbox Code Playgroud)
你的意思是?
$result = substr($search,strlen($trim));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
693 次 |
| 最近记录: |