URL友好标题短划线不会转换为null

时间:2013-05-17 00:43:31

标签: php

我有以下代码

$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中添加短划线。我试图在修剪之前有一个单独的str_replace,在preg_replaces之后等等。它似乎不起作用。

0 个答案:

没有答案