Home  >  Article  >  Backend Development  >  分割字符串~

分割字符串~

WBOY
WBOYOriginal
2016-06-13 10:18:47808browse

分割字符串求助~~!!!
有这么一坨字符串:
/xxxx/zzzz/vvvv/bbbb/default_head/user1.gif
/video/templates/templates/images/default_head/user2.gif
......
/xxxx/zzzz/vvvv/bbbb/default_head/user14.gif

我需要得到user后面 和 “.” 前面的数字啊 (如1,2,14)

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

PHP code
<?php $str='/xxxx/zzzz/vvvv/bbbb/default_head/user14.gif';preg_match('/(\d+)\.[^.]+/',$str,$match);echo $match[1];<div class="clear">
                 
              
              
        
            
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