Home > Backend Development > PHP Tutorial > PHP code to output data in the form of pictures

PHP code to output data in the form of pictures

WBOY
Release: 2016-07-25 08:45:44
Original
1226 people have browsed it
  1. $query="select count(ip) as count_ip from tb_count04 ";
  2. //查询数据库中总的IP访问量
  3. $result=mysql_query($query);
  4. $countes=mysql_result($result,0,'count_ip');
  5. //通过GD2函数创建画布
  6. $im=imagecreate(240,24);
  7. $gray=imagecolorallocate($im,200,200,200);
  8. $color =imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255)); //定义字体颜色
  9. //输出中文字符
  10. $text=iconv("gb2312","utf-8","统计IP的数量:");
  11. //对指定的中文字符串进行转换
  12. $font = "fonts/FZHCJW.TTF";
  13. imagettftext($im,14,0,20,18,$color,$font,$text); //输出中文
  14. //输出网站的访问次数
  15. imagestring($im,5,160,5,$countes,$color);
  16. imagepng($im);
  17. imagedestroy($im);
  18. ?>
复制代码

PHP


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template