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-679fd514c9b67138411821/] with [crayon-679fd514c9b77284462246/]
You should first test the existence of a file by file_exists(). [crayon-679fd514c9c5d485252513/] or simple solution…
Note: from WordPress Use it like this: [crayon-679fd514c9d4a111587355/] Code: [crayon-679fd514c9d4e281470216/]
[crayon-679fd514c9eb6332957350/] or [crayon-679fd514c9eb9558249241/]