问题
i want to rename file in php when file name is persian(farsi/arabic).
file name: 'ش' and i want to rename 'a'
and this code not work:
rename("ش", "a");
result:
Warning: rename(ش,a): The system cannot find the file specified. (code: 2) in C:\xampp_new\htdocs\vira2\test.php on line 5
PHP Version 5.6.3 on Xampp on Windows
回答1:
Edit:
<?php
setlocale(LC_ALL, 'ar');
mkdir('ش');
rename('ش', 'a');
回答2:
You have to include the path of the file.
<?php
rename("c\ش", "c\a"); ?>
来源:https://stackoverflow.com/questions/30145260/rename-file-name-persian-farsi-arabic-in-php