php ascii如何转中文
2022-12-02 09:01:16
91
{{single.collect_count}}

php删除自身的实现方法:首先创建一个PHP示例文件;然后引入自身文件;最后通过“@unlink ($file);”方法删除自身文件即可。

php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

本文操作环境:windows7系统、PHP7.1版,DELL G3电脑

很多朋友使用php的时候需要让该文件只能被访问一次,(比如cms的程序安装,数据库的查询或修改)那么该如何让php删除自身呢,我们可以用以下代码来完成:

$file = "zzz.php";if (file_exists($file)) { @unlink ($file);}
登录后复制

指定$file为zzz.php,那么当程序运行到这里的时候,就会删除zzz.php这个文件,当然,你也可以把$file指定为php代码本身。

推荐学习:《PHP视频教程

以上就是php怎么删除自身的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}