Class encapsulation verification diagram how to output + JS this is a class encapsulation verification diagram my question is how to call it PHPcode & lt; on another page ;? PhpclassImageCode {private $ randcode; class encapsulation verification diagram how to output + JS
This is a verification chart encapsulated by a class. My question is how to call it on another page.
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) ;}}?>
Below is the output page
PHP code
Untitled Document