mkdir

Why can't PHP create a directory with 777 permissions?

纵饮孤独 提交于 2019-11-26 07:23:51
问题 I\'m trying to create a directory on my server using PHP with the command: mkdir(\"test\", 0777); But it doesn\'t give full permissions, only these: rwxr-xr-x 回答1: The mode is modified by your current umask , which is 022 in this case. The way the umask works is a subtractive one. You take the initial permission given to mkdir and subtract the umask to get the actual permission: 0777 - 0022 ====== 0755 = rwxr-xr-x. If you don't want this to happen, you need to set your umask temporarily to

How do I use filesystem functions in PHP, using UTF-8 strings?

北慕城南 提交于 2019-11-25 23:37:52
问题 I can\'t use mkdir to create folders with UTF-8 characters: <?php $dir_name = \"Depósito\"; mkdir($dir_name); ?> when I browse this folder in Windows Explorer, the folder name looks like this: Depósito What should I do? I\'m using php5 回答1: Just urlencode the string desired as a filename. All characters returned from urlencode are valid in filenames (NTFS/HFS/UNIX), then you can just urldecode the filenames back to UTF-8 (or whatever encoding they were in). Caveats (all apply to the