Bunu yapmak için bir işlevi olduğunu sanmıyorum, ben son zamanlarda bu olsa yarattı:
function fix_url($word) {
/**
* whilst the descriptor in the url will be for SEO
* purposes only, we need to ensure it doesn't break
* the URI rules http://www.faqs.org/rfcs/rfc2396.html
*/
// convert to lower case
$word=strtolower($word);
// define illegal / replacement characters
$illegal = array("ä","ö","ü","ß");
$replace = array("a","o","u","ss");
$word = str_replace($illegal, $replace, $word);
// remove & for and
$word=str_replace("&","and",$word);
// remove a space for -
$word=str_replace(" ","-",$word);
// and replace all non alphanumeric characters or a dash
$word=ereg_replace("[^A-Za-z0-9-]", "", $word);
return $word;
}
Güvenli bir biri ile geçersiz bir karakter değiştirme bir örnek dahil ettik.
Ben bu kodu denedim ve latest-article-about-german-letters---handling-aou-and-ss
açıkçası biraz tweaks yapmak için hala vardır döndürür (bkz. ---), butIi'm bu uyarlamak kolay olacaktır emin olun.