Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]zmiana polskich znaków w permalinku
bethebest
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 25.12.2007

Ostrzeżenie: (0%)
-----


mam taka funkcje do zmiany tytulu danego artykulu na PERMALINKA. Czyli jesli jest tytuł "Zośka poszła spać" to zmmienia na zoska-poszla-spac. Problem tkwi w tym, że nie wiem jak zmienić litery ęśąć itp na esac itp . $result = preg_replace('/ś/', ' s', $result); nnie działa;/

public function getStrippedTitle()
{



$result = strtolower($this->getTitle());

// strip all non word chars
$result = preg_replace('/\W/', ' ', $result);


// replace all white space sections with a dash
$result = preg_replace('/\ +/', '-', $result);

// trim dashes
$result = preg_replace('/\-$/', '', $result);
$result = preg_replace('/^\-/', '', $result);





return $result;
}
Powód edycji: dodałem tag (cysiaczek)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 15.10.2025 - 11:42