Copy CodeThe code is as follows:
/*
Code features: Use PHP to skillfully set the image by the time of creation to classify storage;
The picture file property must be removed from 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, it is established;
$fileNewPath = $path. ' \ \ '. FileTime ($path. ' \ \ '. $value);
if (!file_exists ($fileNewPath)) {
mkdir ($fileNewPath);
}
MoveFile ($path. ' \ \ '. $value, $fileNewPath. ' \ \ '. $value);
}
}
Get File modification Time
function FileTime ($STR) {
Return date ("Y-m-d", Filemtime ($STR));
}
Move a file to a new address
function MoveFile ($file, $path) {
Copy ($file, $path);
echo $file. ' Location update complete
';
Unlink ($file);
echo $file. ' Original location file deleted ';
}
?>
The above describes the storage for the web format used by PHP to classify the image by the creation time to store the implementation of the code, including storage for the web in the format of the content, I hope that the PHP tutorial interested in a friend helpful.