Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Automatyczna zmiana ą, ę, ł ... na a, e, l..., Upload plików
camelx
post
Post #1





Grupa: Zarejestrowani
Postów: 117
Pomógł: 0
Dołączył: 14.06.2004
Skąd: Warszawa

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


Mam system do uploadu plików na serwer. Chcę, żeby podczas uploadu wszystkie polskie literki w nazwie pliku zmieniały sie na ich odpowiedniki bez ogonków (ą na a, ę na e, itd.) Zrobiłem coś takiego
  1. <?php
  2. $filename = jakiś_plik;
  3. $filename2 = str_replace(&#092;"ś\",\"s\",$filename); // zamiana ś na s
  4. ?>

Co zrobić, żebym nie musiał robić str_replace dla każdej literki (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Wiem, że chyba trzeba wykorzystać tablice, ale nie wiem jak... Bedę bardzo wdzięczny za pomoc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował camelx 24.05.2005, 14:06:27
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dr_bonzo
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

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


iconv" title="Zobacz w manualu PHP" target="_manual
Cytat
string iconv ( string in_charset, string out_charset, string str )

Performs a character set conversion on the string str from in_charset to out_charset . Returns the converted string or FALSE on failure.

If you append the string //TRANSLIT to out_charset transliteration is activated. This means that when a character can't be represented in the target charset, it can be approximated through one or several similarly looking characters. If you append the string //IGNORE, characters that cannot be represented in the target charset are silently discarded. Otherwise, str is cut from the first illegal character.


i konwertujemy z iso/win/inny na latin1 z //TRANSLIT, chociaz nie dzialao mi to kiedys, ale polecam sprawdzic.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 17.10.2025 - 07:49