去除斜杠
程序员文章站
2022-06-02 23:37:15
...
/Public/Uploads/Photo/ 这个该怎么替换成 Public/Uploads/Photo/
回复讨论(解决方案)
substr("/Public/Uploads/Photo/",1,100);
ltrim应该简单些吧?
$str = '/Public/Uploads/Photo/';echo substr($str,1);
ltrim应该简单些吧?
+1
$str = '/Public/Uploads/Photo/';echo ltrim($str,'/');
ltrim($str,'/');
不仅仅是简单!如果原串没有前导的“/”呢,还 substr ?