php中设置index.php文件为只读的方法
发布时间:2020-12-13 06:14:06 所属栏目:PHP教程 来源:网络整理
导读:为index.php文件设置只读属性后,木马就没权限给你文件末尾追加广告了。 下面我们看具体的代码,设置index.php只读: 代码如下: function set_writeable($file_name) { if(@chmod($file_name,0555)) { echo "修改index.php文件只读属性成功"; } else { echo
为index.php文件设置只读属性后,木马就没权限给你文件末尾追加广告了。 代码如下: function set_writeable($file_name)
{ if(@chmod($file_name,0555)) { echo "修改index.php文件只读属性成功"; } else { echo "修改index.php文件只读属性失败,空间商不支持此操作!"; } } set_writeable("index.php"); ?> 把以上内容保存成setread.php,然后上传到空间,直接浏览器浏览该地址即可设置只读。 代码如下: function set_writeable($file_name)
{ if(@chmod($file_name,0777)) { echo "修改index.php文件读写属性成功"; } else { echo "修改index.php文件读写属性失败,空间商不支持此操作!"; } } set_writeable("index.php"); ?> 保存以上内容为:setwrite.php,通过浏览器访问即可设置读写权限了。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |