I searched on StackOverflow but I have not found a solution to my problem .. I should create a directory (if not already present), and move a file (.Zip) previously created on this new folder
I tried the following solutions
//create zip
Zip('editor', 'backup_'.date("d_m_Y__H_i_s").'.zip');
//create folder
mkdir('backup', 0777, true);
//move file
rename('backup_'.date("d_m_Y__H_i_s").'.zip', 'backup/backup_'.date("d_m_Y__H_i_s").'.zip');
//create zip
Zip('editor', 'backup_'.date("d_m_Y__H_i_s").'.zip');
//create folder
$ret = mkdir('backup', 0777, true);
//move file
rename('backup_'.date("d_m_Y__H_i_s").'.zip', 'backup/backup_'.date("d_m_Y__H_i_s").'.zip');
//create zip
Zip('editor', 'backup_'.date("d_m_Y__H_i_s").'.zip');
//create folder
$ret = mkdir('backup', 0777, true);
//move file
move_backup();
function move_backup(){
rename('backup_'.date("d_m_Y__H_i_s").'.zip', 'backup/backup_'.date("d_m_Y__H_i_s").'.zip');
}
@date_default_timezone_set("Europe/Rome");
$my_time = date("d_m_Y__H_i_s");
function Zip($source, $destination){
....
}
function sposto_backup($t){
rename('backup_'.$t.'.zip', 'backup/backup_'.$t.'.zip');
}
Zip('editor', 'backup_'.$my_time.'.zip');
if (!file_exists('backup')) {
$r = mkdir('backup', 0777, true);
sposto_backup($my_time);
}else{
sposto_backup($my_time);
}
这很可能是权限问题-如果您在代码中启用了错误报告功能或捕获了错误,则可以自行识别问题。
You could try moving your mkdir()'s into if statements since the PHP documentation shows that mkdir returns true on success. This means that once the mkdir function has successfully executed, the content inside the if statement will execute.
if(mkdir('backup', 0777, true))
{
}
or
if($ret = mkdir('backup', 0777, true))
{
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.