PHP file_exists with accent returns false

蓝咒 提交于 2019-12-30 18:06:59

问题


I have two folders, Folder and Folderé. The second one could not be catch by PHP.

Here is my test:

<?php
        $dir = 'D:\wamp\www\test\data\Folder';
        var_dump(file_exists($dir)); // true

        $dir = 'D:\wamp\www\test\data\Folderé';
        var_dump(file_exists($dir)); // false
?>

How to fix it?


回答1:


This works like charm

<?php
$dir = 'D:\wamp\www\test\data\Folderé';
var_dump(file_exists((utf8_decode($dir))));


来源:https://stackoverflow.com/questions/19200750/php-file-exists-with-accent-returns-false

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