怎么在文件名中每间隔两个字符添加符号

WBOY
Release: 2016-06-13 13:08:08
Original
1416 people have browsed it

如何在文件名中每间隔两个字符添加符号
文件名是格式是这样: ab-cb-ef
使用str_replace把中横线过滤掉然后保存到数据库.
当从数据库里取出abcdef时,如何实现每隔2个字符插入"-", 得到ab-cd-ef 的文字? 谢谢.

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

PHP code
$str='abcdef';
for($i=0;$i<strlen echo join></strlen><font color="#e78608">------解决方案--------------------</font><br>trim(preg_replace('~(.{2})~','$1-',$x),'-'); <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