Home >Backend Development >PHP Tutorial >去除斜杠
/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 ?