stu*_*man 6 php regex
例: -this--is---a-test--
-this--is---a-test--
我想要的是: this-is-a-test
this-is-a-test
谢谢你的回答!:)
Gum*_*mbo 18
我会用的组合preg_replace和trim:
preg_replace
trim
trim(preg_replace('/-+/', '-', $str), '-')
该preg_replace调用删除多个破折号并trim删除前导和尾随破折号.
归档时间:
16 年,5 月 前
查看次数:
3043 次
最近记录:
13 年,4 月 前