PHP verification code @ symbol

Source: Internet
Author: User
PHP verification code @ symbol PHPcode & lt ;? Phpsession_start (); for ($ i0; $ I & lt; 4; $ I ++) {@ $ rand. dechex (rand (160); [email & #; protected], the image cannot be displayed .} @ $ _ SESSION [check_p help PHP verification code @ symbol
PHP code
  
  



PHP code
  
  


[Email protected]? Incorrect prompt
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 is the error?


------ Solution --------------------
Quote $ _ SESSION ["check_pic"]

Undefined constant refers to an undefined constant, which is treated as a constant without quotation marks.
------ Solution --------------------
PHP code
For ($ I = 0; $ I <4; $ I ++) {$ rand = ''; $ rand. = dechex (rand (); [email protected], the image cannot be displayed. } $ _ SESSION ['Check _ pic '] = $ rand; [email protected] and all are garbled characters.
------ Solution --------------------
$ Rand. =

This variable is used when no value is assigned, so the notice error occurs. The image is binary and the notice is text. The combination of the two causes the image to fail to be displayed.

Solution:
Assign a value to $ rand first.

$ Rand = '';


------ Solution --------------------
PHP code
Session_start (); $ rand = ''; for ($ I = 0; $ I <4; $ I ++) {$ rand. = dechex (rand (); [email protected], the image cannot be displayed. } $ _ SESSION ['Check _ pic '] = $ rand; [email protected] and all are garbled characters. $ Im = imagecreatetruecolor (255,255,255, 30); $ bg = imagecolorallocate ($ im, 0); $ te = imagecolorallocate ($ im,); imagestring ($ im, 0, $ rand, $ te); header ("content-type: image/jpeg"); imagejpeg ($ im );
------ Solution --------------------
Discussion
PHP code

Session_start ();

For ($ I = 0; $ I <4; $ I ++ ){
@ $ Rand. = dechex (rand (); [email protected], the image cannot be displayed.
}
@ $ _ SESSION [check_pic] = $ rand; [email protected] and all are garbled characters. ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.