The read cache function can be avoided only when the verification code is added. this is an image verification function packaged in the class. However, I don't know where to add a time string to avoid reading the cache. PHPcode & lt ;? PhpclassImageCode {private $ randcode; the random character verification code can be read from the cache only when the time string is added.
This is an image verification function I used in class packaging, but I don't know where to add a time string to avoid reading the cache.
PHP code
Randcodelength = 5; $ this-> imgWidth = 80; $ this-> imgHeight = 20; $ this-> codelength = count ($ this-> code)-1; // Obtain the array length. the random range is $ this-> createrandcode (); $ this-> createimg (); $ this-> createString (); $ this-> drawline ($ this-> line); $ this-> ending ();} function createrandcode () {for ($ I = 0; $ I <$ this-> randcodelength; $ I ++) {// initialize the verification code $ this-> randcode. = $ this-> code [rand (0, $ this-> codelength)] ;}} function createimg (){/ /Create an image foreground background color $ this-> image = imagecreatetruecolor ($ this-> imgWidth, $ this-> imgHeight ); $ this-> background = imagecolorallocate ($ this-> image, 255,255,255, 0); $ this-> foreground = imagecolorallocate ($ this-> image );} function createString () {// create the string imagestring ($ this-> image, 5, rand (5, 35), 0, $ this-> randcode, $ this-> foreground );} function drawline ($ some) {for ($ I = 0; $ I <$ some; $ I ++) {imageline ($ this-> image, ra Nd (1, $ this-> imgWidth), rand (1, $ this-> imgHeight), rand (1, $ this-> imgWidth), rand (1, $ this-> imgHeight), $ this-> foreground) ;}} function ending () {ob_clean (); // discard the cache Content header ("Content-type: image/jpeg "); imagejpeg ($ this-> image) ;}}?>
------ Solution --------------------
Search for images on the Internet.
Script
Function RefreshCode (obj ){
Obj. src = obj. src + "? Code = "+ Math. random ();
}
Script