PHP mkdir( $recursive = true ) skips last directory

后端 未结 7 1991
南旧
南旧 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:51

    Try to remove the trailing slash from your path.

    At least that's how it's being used in the examples of the mkdir documentation.

    Personally I can't remember having problems, but I usally don't append trailing slashes, so go and try that.

    UPDATE:

    I just tried your code and it created every directory including the last one. I'm running Mac OS X 10.5. No idea why it's not working for you :-(

    That's the code I used:

    Sorry, seems like I'm of no help here.

提交回复
热议问题