简体   繁体   中英

Yii Modules and createUrl

I'm trying to set up an Ajax call function actionAjaxDialog within my Module's DefaultController.php

Originally, I didnt have this set up as a module so I had to convert it. Now that it's converted however it no longer works. I keep getting 404 not found errors and I've tried a few variations:

echo Yii::app()->createUrl('/firmtickets/DefaultController/AjaxDialog');
echo Yii::app()->createUrl('/DefaultController/AjaxDialog');
echo Yii::app()->createUrl('firmtickets/DefaultController/AjaxDialog');
echo Yii::app()->createUrl('DefaultController/actionAjaxDialog');
etc...

('firmtickets' being the module name)

Which create variations of:

http://localhost/clcms_yii/index.php?r=firmtickets/DefaultController/AjaxDialog

It's the first time I've ever made a Yii Module, so I'm assuming I'm doing something completely wrong

Only provide the controller name ie "default"

the name of the controller is "default" not "defaultController"

try this

echo Yii::app()->createUrl('/firmtickets/default/ajaxDialog');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM