|
użytkowników online: 65
|
OPINIE UŻYTKOWNIKÓW
|
Porady zamieszczone tutaj przez Darka są pomocne w wielu chwilach. Wielokrotnie tworząc jakiś złożony serwis korzystam z tych porad. Można by tworzyć samemu te skrypty, ale tak naprawdę czy nie lepiej jest wziąć skrypt z tej strony i zmodyfikowac go dla swoich potrzeb? Wprawdzie możemy taki skrypt napisać sami, ale po co, skoro stracimy czas na coś, co ktoś juz napisał, przetestował i może zagwarantować, że działa poprawnie. Któryś raz z rzędu opłacam abonament i nie raz jeszcze opłacę. Kawał dobrej roboty i ogrom wiedzy w jednym miejscu.
Piotr Karamański Design Studio
|
|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
umask (PHP 3, PHP 4, PHP 5) umask -- Changes the current umask Descriptionint umask ( [int mask] )
umask() sets PHP's umask to
mask & 0777 and returns the old
umask. When PHP is being used as a server module, the umask
is restored when each request is finished.
umask() without arguments simply returns the
current umask.
User Contributed Notesandi<at>splitbrain.org
03-Mar-2005 11:03
To play around with umasks and permissions use this little fragment:
<?
$umask = 0012;
$perm = 0777;
printf("umask: %04o perm: %04o result: %04o\n",
$umask,$perm,$perm & (0777 - $umask));
?>
trisk at earthling dot net
31-Jan-2005 06:25
I thought I would clarify the numbering scheme used here, as it confused me at first.
On the UNIX console, the command:
umask "blah"
In this instance, the umask command forces "blah" to be an octal number, regardless of how many digits you use and regardless of any leading zeroes. In PHP, umask() does not default to octal as the console command does, it uses whatever numeric format you specify.
For example:
umask(213);
This uses the decimal integer 213 and not the octal number 213 as you would expect when using the console command. In this case, it would set the umask to the octal number "325".
To enter the number as octal, just add one or more zeroes to the left of the number:
umask(0213);
umask(07);
umask(0044);
etc.
notepad at codewalkers dot com
19-Jun-2004 03:43
$old = umask(0);
chmod("/some/dir", 0755);
umask($old);
sam at totallydigital dot co dot nz
20-Sep-2002 06:04
The first comment perhaps didn't quite make clear what's on with your umask and the permissions.
The permission passed to a command is first bitwise ANDed with the _INVERSE_ of the current umask, then applied to the file.
For example, umask = 0011 and permission = 0775
The inverse of 0011 = 0766
0775 AND 0766
= 111.111.101 AND 111.110.110
= 111.110.100
= 0764
voudras at swiftslayer dot org
28-May-2001 02:47
save yourself some trouble by using umask with 4 digits, vs just three
wptate at olemiss dot edu
29-Feb-2000 10:19
The -S option will print the symbolic values of umask, while changing the umask to the new setting.
(i.e. umask -S 007 will print 'u=rwx,g=rwx,o=')
rlynch at ignitionstate dot com
11-Feb-2000 03:41
umask affects permissions when files and directories are created.<BR>
umask is short for "Un-Mask".<BR>
So umask is "and"ed with the permissions of mkdir, fopen, etc.<BR>
In a sense, the umask setting is "subtracted" from the permissions given to mkdir.<BR>
Example:<BR>
<PRE>
umask(011);
mkdir('foo', 0777);
</PRE>
will actually make a directory with permissions 0766.
|