How do I check if a directory is writeable in PHP?

前端 未结 10 1613
别跟我提以往
别跟我提以往 2021-01-01 08:07

Does anyone know how I can check to see if a directory is writeable in PHP?

The function is_writable doesn\'t work for folders.

Edit: It doe

10条回答
  •  旧时难觅i
    2021-01-01 08:57

    to be more specific for owner/group/world

    $dir_writable = substr(sprintf('%o', fileperms($folder)), -4) == "0774" ? "true" : "false";
    

    peace...

提交回复
热议问题