Maison > Article > développement back-end > php将标点符号替换为空格
php用正则匹配将符号替换为空格
<?php $character = "!@#$%^&*中'文中'文中'文().,<>|[]'\":;}{-_+=?/abcdefgh中'文ijklmnopqrstuvwx中'文yzABCDEFGHI中文JKLMNOPQRSTUVWXYZ~`中'文文文文文";$reg = "/[[:punct:]]/i";$character = preg_replace($reg, '', $character);print_r($character);die;?>