The chmod() function changes the permissions of the specified file.
Returns TRUE if successful and FALSE if failed.
chmod(file,mode)
parameter | describe |
---|---|
file | Required. Specifies the documents to be checked. |
mode | Required. Specify new permissions. The mode parameter consists of 4 numbers: The first number is usually 0 The second number specifies the owner's permissions The third number specifies the permissions of the user group to which the owner belongs The fourth number specifies everyone else's permissions Possible values (to set multiple permissions, total the numbers below): 1 = execute permission 2 = write permission 4 = Read permission |
<?php// Read and write for owner, nothing for everybody elsechmod("test.txt",0600);// Read and write for owner, read for everybody elsechmod("test.txt",0644);// Everything for owner, read and execute for everybody elsechmod("test.txt",0755);// Everything for owner, read for owner's groupchmod("test.txt",0740);?>