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 orfalse
on failure.note: don't have create folder
clean
first if you're usingrecursive = true
option, otherwise folder namedclean
must created first.
ps. i've created directory using code before posting should not have problem.
Comments
Post a Comment