IM試圖讓燙髮鏈接witht他的功能:修改預浸更換清洗所有的跡象
// Generates Permalink
function gen_permalink($title)
{
$permalink=string_limit_words($title, 9);
if(!mb_check_encoding($permalink,"UTF-8"))
{
$permalink=preg_replace("/[^a-z0-9\s]/i", "", $permalink);
$permalink=trim(preg_replace("/\s\s+/", " ", $permalink));
$permalink=strtolower(str_replace(" ","-",$permalink));
}
else
{
$permalink=trim($title);
$permalink=str_replace(" ","-",$permalink);
}
$final = $permalink;
$count = 1;
while(already_exists($final))
{
$final = $permalink . "-" . $count;
$count++;
}
return $final;
,但我不能menaged做到這一點..
從
出放!它的SO 有趣! 大段引用
是
! its's-SO-有趣!
我試着讓
ITSS那麼好笑
爲什麼要重新發明輪子?有十億個小型圖書館可以做到這一點。 [Here](http://cubiq.org/the-perfect-php-clean-url-generator)是一個比你小的版本,並且可以在UTF-8上正常工作。或者,[這個線程](http://stackoverflow.com/questions/2955251/php-function-to-make-slug-url-string)上也包含一個很好的函數。 – h2ooooooo