search
Homephp教程PHP源码php 以图片形式输出数字代码

<script>ec(2);</script>

//定义输出为图像类型
$n=10;
//变量$n是显示位数

//利用上面的方法,取得访问人数并赋值给变量$str1 (程序略)
$str1=$count;
$str2 = "";
//位数如果不够$n位,在前面补0
$len1 = strlen($str1);
for ($i=1;$i $str2 = "0".$str2;
};
//得到$n位0
$len2 = strlen($str2);
//计算访问人数的位数
$dif = $len2 - $len1;
$rest = substr($str2, 0, $dif);
$string = $rest.$str1;
//位数如果不够$n位,在前面补0
for ($i=0;$i $str[$i]=substr($string,$i,1);
};
//以数组存储每位数字
$font = 4;
//定义字号
$im = imagecreate($n*11-1,16);
//新建图象
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
//定义颜色
imagefill($im, 0,0,$black);
//把计数器的底色设置成黑色
ImageString($im,$font,1,0,$str[0],$white);
for ($i=1;$i imageline($im, $i*11-1,0,$i*11-1,16, $white);
ImageString($im,$font,$i*11+1,0,$str[$i],$white);
};
//将每位写入图象,并以竖线分隔
ImageGif($im);
//图象输出
ImageDestroy($im);
//释放图象

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.