【问题标题】:Use VisualCaptcha in Laravel在 Laravel 中使用 VisualCaptcha
【发布时间】:2014-08-29 20:02:02
【问题描述】:

我正在尝试将 VisualCaptcha 与我的 Laravel 应用程序一起使用。我试图用我的代码来调整这个exemple。但我不知道如何将以下回调调整到我的控制器:

$app->get( '/audio(/:type)', function( $type = 'mp3' ) use( $app ) {
    $captcha = new \visualCaptcha\Captcha( $app->session );

    if ( ! $captcha->streamAudio( $app->response, $type ) ) {
        $app->pass();
    }
} );

这是我的控制器:

class CaptchaController extends BaseController {

    /**
     * Start Captcha
     */
    public function start($params)
    {
        $session = new SessionCaptcha();
        $captcha = new Captcha($session);
        return $captcha->generate();
    }


    public function audio()
    {
        $session = new SessionCaptcha();
        $captcha = new Captcha($session);

        //$response = Response::make();
        $response->header('Access-Control-Allow-Origin', '*');

        //return var_dump($response);
        return $captcha->streamAudio($response, 'mp3');
    }



}

启动功能有效,但音频功能无效...我不知道如何将第一个参数添加到“$captcha->streamAudio($firstParam, $extension)”。

【问题讨论】:

    标签: php laravel captcha


    【解决方案1】:

    以防万一其他人先登陆这里,https://github.com/emotionLoop/visualCaptcha-PHP/issues/16#issuecomment-53863330已经回答了这个问题

    作者提到不返回$captcha->generate();,还有一些未公开的修改。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-10
      • 2016-07-09
      • 2020-12-27
      • 2019-01-11
      • 2019-03-23
      • 2019-04-13
      • 2018-12-24
      • 2015-01-01
      相关资源
      最近更新 更多