Home  >  Article  >  Backend Development  >  php rtrim函数在处理时去掉字符t是怎么回事啊

php rtrim函数在处理时去掉字符t是怎么回事啊

WBOY
WBOYOriginal
2016-06-23 13:42:30960browse

    
输出结果为lef。
怎么解决这个问题???????


回复讨论(解决方案)

用str_replace 替换得了。

因为 rtrim 的第二个参数是字符列表,而不是字符串

lef t.htm 的 t 也在列表 .h tm 中,当然也会被删掉

trim 的第二个参数是charlist   表示字符的集合    left的t在'.htm'中


如果只是取得文件名字  用basename即可

$file = "left.htm";

echo basename($file,'.htm');//left









$str='left.htm';echo substr($str,0,strpos($str,'.'));

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn