Home > Backend Development > PHP Tutorial > Why do I always get an error after using mkdir? ?

Why do I always get an error after using mkdir? ?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-09-19 09:16:25
Original
1997 people have browsed it

After execution, the file can be created successfully, but an error message is always given Warning: mkdir(): File exists in D:wamp64wwwaaa.php on line 26 I only go back to execute this sentence when $name2 obviously does not exist

<code>if(!is_dir($name2)){
        mkdir(iconv("UTF-8", "GBK", $name2),0777,true);
      }</code>
Copy after login
Copy after login

Reply content:

After execution, the file can be created successfully, but an error message is always given Warning: mkdir(): File exists in D:wamp64wwwaaa.php on line 26 I only go back to execute this sentence when $name2 obviously does not exist

<code>if(!is_dir($name2)){
        mkdir(iconv("UTF-8", "GBK", $name2),0777,true);
      }</code>
Copy after login
Copy after login

I just tested it and there is nothing wrong with your code. Please check it or take a look at the logic.

<?php
$name2='dirmk';
if(!is_dir($name2)){
    mkdir(iconv("UTF-8", "GBK", $name2),0777,true);
}
Copy after login
Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template