문제

Is there another way how to make directory in php? mkdir() is not working. I have tried this:

 if (!file_exists('path/to/directory')) {
     mkdir('path/to/directory', 0777, true);
 }

from here: Create a folder if it doesn't already exist

I have no error, no warning, code is doing nothing.

도움이 되었습니까?

해결책

A few things to try:

  • Make sure you have error output enabled (including those pesky E_NOTICEs)
  • As others mentioned, if mkdir returns false, it's a failure. Do you have write access?
  • Are you really passing 'path/to/directory'? If yes, does 'path/to/' already exist? If 'path/to/' doesn't exist, you need to pass the third bool param as true, the docs are pretty clear on what it does.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top