如何使用php编辑和更新/ etc / hosts文件

时间:2013-11-20 06:18:28

标签: php ubuntu hosts

动态地我想编辑和更新我的(/etc/hosts) hosts文件以使用php

添加域

我在php中尝试过这段代码

exec ("sudo chmod 777 /etc/hosts");
fopen("/etc/hosts", "r")

我在php

中收到错误Warning: fopen(/etc/hosts): failed to open stream:

0 个答案:

没有答案