PHP mkdir( $recursive = true ) skips last directory

后端 未结 7 1993
南旧
南旧 2021-02-20 10:39

I\'ve got the following piece of code on a PHP 5.2.4 (no safe_mode) linux server:

mkdir( $path, 0777, true );

when I enter a path like:

<
7条回答
  •  感动是毒
    2021-02-20 10:59

    You'll get this error if you make the silly mistake I did and pass a string, rather than the numeric literal for mode.

    mkdir( $path, "0777", true ); // BAD - only creates /a/b
    
    mkdir( $path, 0777, true ); // GOOD - creates /a/b/c/d
    

提交回复
热议问题