Chown () Function Example Tutorial _php tutorial

Source: Internet
Author: User
The following function is chown related information Oh, well, crap don't say come to see it.

The following function is chown related information Oh, well, crap don't say come to see it.

Chown

(PHP 4, PHP 5)

chown-Changing the file owner

Describe
Boolean chown (string $ file name, mixed $ user)
Attempt to change the file owner profile to the user's user. Only supervisor can change people's files.

Parameters

Filename
The file path.

User
User name or number.


return value
Returns TRUE or FALSE for successful failure.

Instance

File name and username to use
$file _name= "foo.php";
$path = "/home/sites/php.net/public_html/sandbox". $file _name;
$user _name = "root";

Set the user
Chown ($path, $user _name);

Check the result
$stat = stat ($path);
Print_r (Posix_getpwuid ($stat [' uid ']);

?>
The above example would output something similar to:

Array (7) {
["Name"]=>
String ("Php.net")
["passwd"]=>
String (1) "X"
["UID"]=>
Int (148864)
["GID"]=>
Int (148910)
["Gecos"]=>
String ("Php.net")
["dir"]=>
String ("/home/sites/php.net")
["Shell"]=>
String ("/sbin/nologin")
}
Webmaster Recommendation:

PHP Chinese Online manual


http://www.bkjia.com/PHPjc/445487.html www.bkjia.com true http://www.bkjia.com/PHPjc/445487.html techarticle The following function is chown related information Oh, well, crap don't say come to see it. The following function is chown related information Oh, well, crap don't say come to see it. Chown (PHP 4, ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.