验证码在本地主机上工作,但在远程主机php上不工作

时间:2019-12-09 12:24:12

标签: php localhost captcha remote-server

嗨,我有一个使用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

上进行检查

请帮助我解决这个问题

0 个答案:

没有答案