验证码图像在php中不可见

验证码图像在php中不可见,php,gd,captcha,Php,Gd,Captcha,我已经在centos服务器上预装了GD库和Freetype库。 我无法看到验证码图像 错误: Call to undefined function imagettfbbox() in /path/public_html/captcha/securimage.php 原因可能是什么 谢谢。试着使用reCAPTCHA。 在某些托管服务器中,基于GD的验证码不起作用。我经历过。 reCAPTCHA可以在没有GD库的情况下使用。 它从外部服务加载验证码图像,并使用公钥密码进行验证。 因此,NO内部生成

我已经在centos服务器上预装了GD库和Freetype库。 我无法看到验证码图像

错误:

Call to undefined function imagettfbbox() in /path/public_html/captcha/securimage.php
原因可能是什么


谢谢。

试着使用reCAPTCHA在某些托管服务器中,基于GD的验证码不起作用。我经历过。 reCAPTCHA可以在没有GD库的情况下使用。 它从外部服务加载验证码图像,并使用公钥密码进行验证。 因此,NO内部生成验证码图像。 非常容易使用

例如:

<html>
    <body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
      <!-- your HTML content -->

      <form method="post" action="verify.php">
        <?php
          require_once('recaptchalib.php');
          $publickey = "your_public_key"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
        <input type="submit" />
      </form>

      <!-- more of your HTML content -->
    </body>
  </html>
<?php
  require_once('recaptchalib.php');
  $privatekey = "your_private_key";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
  }
  ?>
前端:

<html>
    <body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
      <!-- your HTML content -->

      <form method="post" action="verify.php">
        <?php
          require_once('recaptchalib.php');
          $publickey = "your_public_key"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
        <input type="submit" />
      </form>

      <!-- more of your HTML content -->
    </body>
  </html>
<?php
  require_once('recaptchalib.php');
  $privatekey = "your_private_key";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
  }
  ?>

后端验证:

<html>
    <body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
      <!-- your HTML content -->

      <form method="post" action="verify.php">
        <?php
          require_once('recaptchalib.php');
          $publickey = "your_public_key"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
        <input type="submit" />
      </form>

      <!-- more of your HTML content -->
    </body>
  </html>
<?php
  require_once('recaptchalib.php');
  $privatekey = "your_private_key";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
  }
  ?>

您可能没有正确安装它,您看到这两个扩展吗?我可以看到GD扩展。我看不到Freetype。但是,在命令行中,它说它已经安装了。命令行!=网络服务器。它们都可以有不同的php.ini文件