$str = 'Álix----_Ãxel!?!?%%%';
strtolower(trim(preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($str, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')), '-'));
// will return alix-axel
但中文字符也会被删掉,此方法仅适用于拉丁语系字符串。
#php
引用关闭,但你能.