function generateRandomString($length = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; }
Output the random string with the call below:
// Echo the random string. // Optionally, you can give it a desired string length. echo generateRandomString();
Other than caching every hour, or every week, you may cache according to file data.…
To get host url of current server simply replace application\config\config.php [crayon-66342e0a02db6175732544/] with [crayon-66342e0a02dbc372556694/]
You should first test the existence of a file by file_exists(). [crayon-66342e0a02f02259412588/] or simple solution…
Note: from WordPress Use it like this: [crayon-66342e0a03013995730739/] Code: [crayon-66342e0a03019035874193/]
[crayon-66342e0a0326b220310199/] or [crayon-66342e0a03284251337977/]