Help PHP Verification Code @ symbol
PHP Code
PHP Code
[email protected]?? Tips for errors
Notice:use of undefined constant code-assumed ' code ' in F:\wamp\apps\project\code_sub.php on line 3
Notice:use of undefined constant code-assumed ' code ' in F:\wamp\apps\project\code_sub.php on line 4
Notice:use of undefined constant check_pic-assumed ' check_pic ' in F:\wamp\apps\project\code_sub.php on line 4
[email protected] What's wrong with this?
------Solution--------------------
Quoted $_session["Check_pic"]
Undefined constant is the meaning of undefined constants, not quoted strings are treated as constants
------Solution--------------------
PHP Code
for ($i =0; $i <4; $i + +) {$rand = '; $rand. =dechex (rand (1,15)); [Email protected], the picture will not show. } $_session[' Check_pic ']= $rand; [Email protected] and it's all garbled.
------Solution--------------------
$rand. =
This variable is used without assignment, so the notice error is caused, the image is binary, the notice is text, and the mixture naturally causes the picture to fail to display.
Workaround:
Assign a value to $rand first
$rand = ";
------Solution--------------------
PHP Code
Session_Start (); $rand = "; for ($i =0; $i <4; $i + +) { $rand. =dechex (rand (1,15)); [ Email protected], the picture will not show. } $_session[' check_pic ']= $rand; [Email protected] and it's all garbled. $im =imagecreatetruecolor (100,30); $BG =imagecolorallocate ($im, 0,0,0); $te =imagecolorallocate ($im, 255,255,255); Imagestring ($im, 5,0,0, $rand, $te); Header ("Content-type:image/jpeg"); Imagejpeg ($im);
------Solution--------------------
Explore
PHP Code
Session_Start ();
for ($i =0; $i <4; $i + +) {
@ $rand. =dechex (rand (1,15)); [Email protected], the picture will not show.
}
@$_session[check_pic]= $rand; [Email protected] and it's all garbled. ......