A verification code class, why don't you just get out of the picture? you just have nothing to worry about. you have customized a verification code generated class, but you don't know why, the picture is just a reality. Please give me some advice.
Img_width = $ img_width; $ this-> img_height = $ img_height; $ this-> font_size = $ font_size; $ this-> line_count = $ line_count ;} // function createCodeImg () {$ this-> createGraphics (); $ this-> getChars (); $ this-> setNoiceLine (); $ x = rand (2, 5); $ arr_X_Y = array ($ x, rand (1, 3), array ($ x + $ this-> font_size, rand (), array ($ x + 2 * $ this-> font_size, rand (), array ($ x + 3 * $ this-> font_size, rand (1, 4); print_r ($ arr_X _ Y); for ($ I = 0; $ I <4; $ I ++) {$ text_color = imagecolorallocate ($ this-> img, rand (180,250 ), rand (180,250), rand (180,250); imagechar ($ this-> img, $ this-> font_size, $ arr_X_Y [$ I] [0], $ arr_X_Y [$ I] [1], $ this-> arr_char [$ I], $ text_color) ;}// create the graphic board function createGraphics () {header ("Content-type: image/png"); $ this-> img = @ imagecreatetruecolor ($ this-> img_width, $ this-> img_height) or die ("image creation failed"); // creates an image $ background_c Olor = imagecolorallocate ($ this-> img, 250,250,250); imagefill ($ this-> img, $ background_color); $ border_color = imagecolorallocate ($ this-> img, 0); // border imagerectangle ($ this-> img, $ this-> img_width, $ this-> img_height, $ border_color );} // call the noise line function setNoiceLine () {for ($ I = 0; $ I <$ this-> line_count; $ I ++) {$ x1 = rand ); // start position $ y1 = rand (2, $ this-> img_height); $ x2 = rand ($ this-> img_width-20, $ this -> Img_width-2); // end position $ y2 = rand (2, $ this-> img_height); $ line_color = imagecolorallocate ($ this-> img, rand (180,250 ), rand (180,250), rand (180,250); imageline ($ this-> img, $ x1, $ y1, $ x2, $ y2, $ line_color );}} // Generate a random string or add or subtract the character function getChars () {$ strCode = ""; if (rand (0, 1) = 1) {// string-type verification code for ($ I = 0; $ I <4; $ I ++) {$ this-> arr_char [$ I] = $ this-> str_chars [rand (0, 56)]; $ strCode. = $ this-> arr_char [$ I];} $ this-> code_res Ult = $ strCode;} else {// addition/subtraction type verification code $ first_num = rand (); $ second_num = 0; $ result = 0; $ arr_operater = array ("+ ", "-"); $ operater = $ arr_operater [rand (0, 1)]; switch ($ operater) {case "+": $ second_num = rand (0, 10 ); $ result = $ first_num + $ second_num; break; case "-": $ second_num = rand (0, $ first_num); $ result = $ first_num-$ second_num; break ;} $ this-> arr_char = array ($ first_num, $ operater, $ second_num, "="); $ this-> cod E_result = $ result ;}}$ YZM = new imageCode (65,27, 16,7); $ YZM-> createCodeImg (); echo ($ YZM-> img_width. "-----". $ YZM-> code_result); imagepng ($ YZM-> img); imagedestroy ($ YZM-> img);?>
Reply to discussion (solution)
Mu Ren
Comment out the 28 rows of print_r ($ arr_X_Y );
Comment out the echo of 91 rows ($ YZM-> img_width. "-----". $ YZM-> code_result );
Comment out the 28 rows of print_r ($ arr_X_Y );
Comment out the echo of 91 rows ($ YZM-> img_width. "-----". $ YZM-> code_result );
These two lines are tested by me and cannot be commented out.
Comment out the 28 rows of print_r ($ arr_X_Y );
Comment out the echo of 91 rows ($ YZM-> img_width. "-----". $ YZM-> code_result );
It's speechless. Why didn't it work at the time? I added these two tests. Why did you say that, after I deleted them, I did it again. I don't understand it.
Oh, sometimes the code is so amazing. check carefully to see if you can find the cause.
Why can't Firefox see the left and right scroll bars in the code box?