rename file name (persian/farsi/arabic) in php

我只是一个虾纸丫 提交于 2021-01-27 08:49:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!