Home  >  Article  >  Backend Development  >  wordpress中输出验证码图片的问题

wordpress中输出验证码图片的问题

WBOY
WBOYOriginal
2016-06-23 14:04:25811browse

要输出的地方是id为209的“页面”

在主题文件夹下的page.php中

<?php     if(is_page('209')){                header("Content-type: image/gif");         header("Cache-Control: no-cache");        $rands = rand(1000,9999);         $im = imagecreate(40, 15);         //var_dump($im);exit();        imagecolorallocate($im, 240, 240, 240);         $loc = 2;         $color1=imagecolorallocate($im, 0, 0, 0);         for($i=0;$i<4;$i++){             $color=imagecolorallocate($im, rand(0,255), rand(0,255), rand(0,255));             imagestring($im, 4, ($loc+1), 1, substr($rands,$i,1), $color1);             imagestring($im, 4, $loc, 0, substr($rands,$i,1), $color);             $loc += 9;         }         imagegif($im);         imagedestroy($im);        exit();    } //验证码?>


该段代码单独文件下正常输出,这里无法正常输出。是wordpress之前的处理过程已经输出了header吗?
我php.ini里有关错误输出的都打开了。。无提示,就是个显示失败的图片


回复讨论(解决方案)

你是如何调用 page.php 的?
是用 img 标签吗?

你是如何调用 page.php 的?
是用 img 标签吗?

我现在直接输出都输不出来

http://localhost:8889/验证码/

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