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-68b68afad35d0192753170/] with [crayon-68b68afad35d6616814535/]
You should first test the existence of a file by file_exists(). [crayon-68b68afad371e513889812/] or simple solution…
Note: from WordPress Use it like this: [crayon-68b68afad38bd416527087/] Code: [crayon-68b68afad38c2237750352/]
[crayon-68b68afad3aaf211540661/] or [crayon-68b68afad3ab3662809136/]