web - PHP mkdir not working as expected -


i'm working on php create folder every time request made server. can't seem syntax proper. if used $date variable works no problem, when add "clean" folder before it, won't create folder.

<?php  $time = $_server['request_time']; $date =  date(ymd_hms, $time); $new =  "clean/".$date;  echo $new;  if(!is_dir ($new)) {     mkdir($new); }  ?> 

put in ' quotes , give mkdir() appropriate params , should work fine:

<?php $time = $_server['request_time']; $date =  date('ymd_his', $time); $new =  "clean/".$date;  echo $new;  if(!is_dir ($new)) { mkdir($new, 0777, true); } ?> 

mode: mode 0777 default, means widest possible access. more information on modes, read details on chmod()

note: mode ignored on windows.

return values:

returns true on success or false on failure.

note: don't have create folder clean first if you're using recursive = true option, otherwise folder named clean must created first.

php manual: mkdir

ps. i've created directory using code before posting should not have problem.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -