我想创建一个目录,但是dir名称包含了hurgarian字符。当我制作一个时,看起来像这样:Ă©而不是“é”。 我该如何解决这个问题?
这是我的代码:
if( isset ( $_POST['submit'] ) )
{
foreach ($_FILES['files']['tmp_name'] as $key => $name_tmp)
{
$name = $_FILES['files']['name'][$key];
$allow = array('gif','jpg','png','JPG','jpeg');
$ext = pathinfo($name, PATHINFO_EXTENSION);
if(!in_array($ext, $allow))
{
echo "<div class='alert alert-danger text-center' role='alert'> The file is not an image!
</br><a class = 'btn btn-default' href = 'upload.php'> Back</a>
</div>";
exit();
}
}
$album = $_POST['album'];
$desc = $_POST['description'];
$radio = $_POST['group'];
$description = $_POST['description'];
$query = "INSERT into albums values ('','$album','$radio','$desc')";
$result = mysqli_query($db_connect,$query);
$folder_name ='photos/'.$album.'/';
if(!file_exists($folder_name))
{
$new_dir = mkdir('photos/'.$album);
$new_dir2 = mkdir('photos/new_'.$album);
}
else
{
echo "<div class='alert alert-danger text-center' role='alert'> The album name is already exist! Please choose another
</br><a class = 'btn btn-default' href = 'upload.php'> Back</a>
</div>";
exit();
}
答案 0 :(得分:0)
您的文件系统不是UTF-8编码,而是另一种编码。如果您在Windows上进行开发,则可能是Windows-1250。你需要转换它:
$folder_name = 'photos/' . iconv('utf-8', $config['filesystem_encoding'], $album) . '/';
其中$config['filesystem_encoding'] = 'windows-1250'
。请记住,您的生产服务器可能会使用开发服务器中的不同编码。