嗨,我有一个使用php
开发的验证码,它在localhost上可以正常工作,但在cpanel中部署的远程服务器上则不能工作。我也启用了cpanel中的gd扩展功能。
<img src="image.php?captcha_text=<?php echo $_SESSION['captcha']; ?>">
image.php
<?php
session_start();
if(isset($_GET['captcha_text']) && isset($_SESSION['captcha'])){
$captcha_text = $_GET['captcha_text'];
$image = imagecreate(100,32);
$backgroundcolor = imagecolorallocate($image,26,26,255);
$text_color = imagecolorallocate($image,255,255,255);
imagestring($image,4,25,8,$captcha_text,$text_color);
header("Content-type: image/png");
imagepng($image);
imagecolordeallocate($text_color, 255, 0, 0);
imagecolordeallocate($backgroundcolor, 255, 0, 0);
imagedestroy($image);
}
?>
您可以在此link
上进行检查请帮助我解决这个问题