Copy code The code is as follows:
/*
Code function: Use PHP to cleverly press the image The creation time is classified and stored;
The image file attribute must cancel the read-only attribute, otherwise it cannot be deleted
By lost63
*/
//Delay setting
set_time_limit(0);
$path='C:Recover File Graphics $Picture JPEG Image (.jpg)';
$result=dir($path);
while($value=$result->read()){
if(strpos($value,'.JPG')==true||strpos($value,'.jpg')==true||strpos($value,'.gif')==true||strpos ($value,'.png')==true){
//If the folder does not exist, create it;
$fileNewPath=$path.'\'.fileTime($path.'\'.$ value);
if(!file_exists($fileNewPath)){
mkdir($fileNewPath);
}
moveFile($path.'\'.$value,$fileNewPath.'\' .$value);
}
}
//Get the file modification time
function fileTime($str){
return date("Y-m-d",filemtime($str));
}
//Move the file to a new address
function moveFile($file,$path){
copy($file,$path);
echo $file.'Location update completed< ;br>';
unlink($file);
echo $file.'The original location file has been deleted';
}
?>
http://www.bkjia.com/PHPjc/321032.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321032.htmlTechArticleCopy the code as follows: ?php /* Code function: Use PHP to cleverly classify and store images according to their creation time; The image file attribute must cancel the read-only attribute, otherwise it cannot be deleted By lost63 */ /...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn