pain.reign
pain.reign

Reputation: 371

mkdir context example php

In php 5.0 context was added to mkdir. But how to use it and what useful things can it do?

And what parameters can be used for context that is passed to mkdir ?)

Upvotes: 5

Views: 1279

Answers (2)

CrsCaballero
CrsCaballero

Reputation: 2348

You need two parameters, "folder" and "permissions". Read this: http://php.net/manual/es/function.mkdir.php

I recommend using chmod() after mkdir().

http://php.net/manual/es/function.chmod.php

Upvotes: 0

James L.
James L.

Reputation: 4097

I believe that the context option was added so that mkdir could be used instead of a connection specific mkdir in PHP like ftp_mkdir:

http://www.php.net/manual/en/context.ftp.php

Although there doesn't seem to be a ton of advantage in adding the context to the mkdir, there is plenty of advantage in adding it to all of the file system creation functions: http://www.php.net/manual/en/stream.contexts.php

As for the parameters, check this out: http://www.php.net/manual/en/context.php

Upvotes: 1

Related Questions