Я написал вот такой код PHP: $uniq = strtolower(str_replace('а','a',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('б','b',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('в','v',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('г','g',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('д','d',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('е','e',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ё','oh',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ж','zh',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('з','z',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('и','i',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('й','j',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('к','k',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('л','l',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('м','m',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('н','n',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('о','o',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('п','p',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('р','r',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('с','s',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('т','t',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('у','u',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ф','f',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('х','x',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ц','c',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ч','ch',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ш','sh',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('щ','w',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ъ','qh',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ы','y',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ь','q',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('э','eh',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('ю','ju',($_FILES['attached']['name']))); $uniq = strtolower(str_replace('я','ja',($_FILES['attached']['name']))); Обьясните мне почему он не работает?
например файл назывался я я.mp3 Он такой и остаеца) А должен переименоваца в ja_ja.mp3 Када тока одна строчка например PHP: $uniq = strtolower(str_replace('г','g',($_FILES['attached']['name']))); Все отлично работает. Файл г.mp3 переименовываеца в g.mp3 а када все прописываю ниче не работает
PHP: <? $ru=array("а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ъ","ы","ь","э","ю","я"); $tr=array("a","b","v","g","d","e","oh","zh","z","i","j","k","l","m","n","o","p","r","s","t","u","f","x","c","ch","sh","w","qh","y","q","eh","ju","ja"); $uniq = strtolower(str_replace($ru,$tr,$_FILES['attached']['name'])); ?> Работает, и всего три строки, взамен твоих ~30.
PHP: <? $ru=array("а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ъ","ы","ь","э","ю","я"); $tr=array("a","b","v","g","d","e","oh","zh","z","i","j","k","l","m","n","o","p","r","s","t","u","f","x","c","ch","sh","w","qh","y","q","eh","ju","ja"); $uniq = str_replace($ru,$tr,strtolower($_FILES['attached']['name'])); ?> так лучше наверное