Codeigniter Botdetect/Tank-Auth 在 Nginx 上找不到验证码 404

Codeigniter Botdetect/Tank-Auth Captcha 404 Not found on Nginx

我想在我的 CodeIgniter 项目中使用 Tank auth,但需要先在 CodeIgniter 中基本安装 Botdetect 验证码。

我已遵循此 link 上的快速入门安装指南。

我试图 运行 此条款的观点保存在 application/views/welcome_message.php 下:

<?php
    defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Welcome to CodeIgniter</title>
        <link type="text/css" rel="Stylesheet" href="<?php echo CaptchaUrls::LayoutStylesheetUrl() ?>" />
    </head>
    <body>

        <?php echo $captchaHtml; ?>
        <input type="text" name="CaptchaCode" id="CaptchaCode" value="" />
    </body>
</html>

而对应的Controller保存在application/controllers/Welcome.php下,同样在下面:

<?php
    defined('BASEPATH') OR exit('No direct script access allowed');

    class Welcome extends CI_Controller {

    public function __construct(){
        parent::__construct();
    }
    public function index() // Your controller
    {
        // load the BotDetect Captcha library and set its parameter
        $this->load->library('botdetect/BotDetectCaptcha', array(
            'captchaConfig' => 'ExampleCaptcha'
        ));

        // make Captcha Html accessible to View code
        $data['captchaHtml'] = $this->botdetectcaptcha->Html();
        $this->load->view('welcome_message',$data);
    }
}

当 运行 在我的浏览器上时,这是我收到的:

我知道 BotDetect 正在使用会话,我已经设法修复了所需的配置,并且正在每个 运行 上的 "ci_sessions" 中创建会话。

如何解决加载 BotDetect 验证码的问题。

您似乎忘记在 "application/config/routes.php" 文件中注册用于 BotDetect 验证码请求(验证码图像、声音、资源等)的 BotDetect 验证码路由。

请检查以下两点:

1 - 确保您已在 "routes.php" 文件中注册 BotDetect Captcha 路由

$route['botdetect/captcha-handler'] = 'botdetect/captcha_handler/index';

2 - 在您的 "controllers" 文件夹中需要有“/controllers/botdetect/Captcha_handler.php”文件

希望对您有所帮助。