JAVASCRIPT
var lblname = "Location Details";
console.log(lblname.replace(/[/\. ,:-]+/g, "-"));
我得到了结果Location-Details
..并且同样的操作如何在php中有任何可用于此操作的php函数?
答案 0 :(得分:1)
您可以使用
<?php
$lblname ="Location Details";
echo preg_replace("/[\/\\. ,:-]+/","-",$lblname);
die;
?>
答案 1 :(得分:0)
preg_replace将是您所需要的
echo preg_replace("/[\/\\. ,:-]+/","-",$lblname);