Can't create a folder with mkdir

做~自己de王妃 提交于 2019-12-04 20:15:43

What about this?

mkdir('c:/files/Users/'.$id)

Couple of possibilities:

  1. Lose the first / since that gives an absolute path and you're looking to make a relative path -- so mkdir('files/Users/'.$id)
  2. Does files/Users already exist (i.e., is there already user 0, user 1, etc.)? If not, you'll need to make them first or do mkdir('files/Users/'.$id, 077, true) to recursively create the directories.

In windows, a path does not start with '/' but with a drive letter. Just remove the first slash (so '/files/users/' becomes 'files/users/').

Further, what Mark said.

PHP states that it makes the best attempt at converting the / between systems. by doing:

mkdir('/files/users');

Confused PHP into thinking it was on a *NIX system. By setting the root to c:, it was now able to properly parse the parameter and deduce that it was a windows system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!