,如果过滤最前面一个小数点

WBOY
Release: 2016-06-13 13:27:58
Original
1058 people have browsed it

请教高手,如果过滤最前面一个小数点?
得到的网址可能有如下格式:
baidu.com

.baidu.com



 $name=substr($name,1);

过滤.baidu.com得到的结果是对的,但如果遇到类似baidu.com的就过滤成aidu.com了,请教用什么代码才能前面有点的就过滤点,没有点的就不过滤?


就是让:
baidu.com或.baidu.com最终都是baidu.com


------解决方案--------------------

PHP code
[User:root Time:11:47:47 Path:/home/liangdong/php]$ php preg.php 
baidu.com[User:root Time:11:47:48 Path:/home/liangdong/php]$ cat preg.php 
<?php echo ltrim('.baidu.com', '.');
?> <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template