How to output a class encapsulation verification diagram + JS

Source: Internet
Author: User
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

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.