M
M
Mike Gasper2015-08-01 01:11:10
Yii
Mike Gasper, 2015-08-01 01:11:10

Yii2, what's wrong with yii\helpers\Url::to() ??

Good day to all !
A couple of days ago I started learning the Yii2 framework. I got to the topic of data validation and came across a captcha widget. When creating it in widget -> template, I wrote a template for displaying captcha in the form, but there was a problem! By specifying the captchaAction => \yii\helpers\Url::to(['main/captcha']) parameter, the request for an image does not go to the MainController to the captcha method, but makes a request to the page localhost/yii.loc/frontend/web/yii. loc/frontend/web/main/main/captcha and in theory it should be localhost/yii.loc/frontend/web/main/main/captcha.
Please help me understand why this is happening!
PS Replaced captchaAction => captchaAction => \yii\helpers\Url::to(['main/captcha']) with captchaAction => 'main/captcha' everything worked fine!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question