0

私は次のコードを持っています

$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 を使用しようとしましたが、うまくいかないようです。

4

0 に答える 0