A blog can automatically switch the background image, but the background image exists elsewhere. so I want to save it to the website server and write a code segment.
A blog can automatically switch the background image, but the background image exists elsewhere. so I want to save it to the website server and write a code segment.
I hope you will give more comments or suggestions.
The path of the image is saved in the txt text file and has been wrapped in a line break. Therefore, it is easy to convert the image path into an array for processing.
Set_time_limit (0); set the execution time. the number in the brackets is the execution time. if it is zero, it is permanently executed until the end of the program. if it is a number greater than zero, no matter whether the program is completed or not, the program ends at the specified number of seconds.
The pathinfo () function returns the file path information in an array. For details, see the previous article introduction: N methods for getting File extensions in php.
The uniqid () function generates a unique ID based on the current time in microseconds.
After obtaining the suffix of the image, file_get_contents () gets the image content. file_put_contents () writes down the image content so that the image is saved. isn't it easy.