简体   繁体   English

使用PHP Chmod文件

[英]Chmod a file using php

Let's say i allow the user to upload a file to my website. 假设我允许用户将文件上传到我的网站。

Using php, i am giving this an address, 使用php,我给这个地址,

$pic = '/~start/B7/images/456.jpg'

how can i chmod this file to make it readable using php? 我如何chmod这个文件,使其使用php可读? I have tried chmod ($pic, 0705); 我已经尝试过chmod ($pic, 0705); but that doesn't seem to work. 但这似乎不起作用。 Thanks for the help. 谢谢您的帮助。

The exec function will allow you execute shell commands. exec函数将允许您执行shell命令。 Try this: 尝试这个:

<?php
 exec("chmod $pic 0705");
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM