zoukankan      html  css  js  c++  java
  • chown

    chown

    chown — 改变文件的所有者

    1 bool chown ( string $filename , mixed $user )

    尝试将文件 filename 的所有者改成用户 user(由用户名或用户 ID 指定)。

    只有超级用户可以改变文件的所有者。

    参数:
    filename

    文件路径。

    user

    用户名或数字。

    返回值:

    成功时返回 TRUE, 或者在失败时返回 FALSE

    简单的 chown() 用法:

    <?php
    
    // 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']));
    
    ?>

    输出结果:

     1 Array
     2 (
     3     [name] => root
     4     [passwd] => x
     5     [uid] => 0
     6     [gid] => 0
     7     [gecos] => root
     8     [dir] => /root
     9     [shell] => /bin/bash
    10 )

    get!:)

     

     

     

     

     

     

     

     

     
     
  • 相关阅读:
    Beta 第七天
    Beta 第六天
    Beta 第五天
    Beta 第四天
    Beta 第三天
    Beta 第二天
    Beta 凡事预则立
    Beta 第一天
    Beta 集合
    打造专属测试平台5-使用Docker部署MySQL数据库
  • 原文地址:https://www.cnblogs.com/xiaohaillong/p/5817062.html
Copyright © 2011-2022 走看看