我有以下代码
$title = trim($tit);
$title = strtolower($tit);
$title = preg_replace("/\s/m", "_", $title);
$title = preg_replace("/\'/m", "_", $title);
$title = preg_replace("/[0-9+~!?@#;$%^&’*()\s]/", "", $title);
当我有以下标题时出现问题
People are great - like or dislike?
这转换为
people_are_great_�_like_or_dislike
我尝试了许多选项,例如在上面代码的最终 preg_replace 中添加破折号。我试图在修剪之前、在 preg_replaces 等之后有一个单独的 str_replace。它似乎不起作用。