Yii控制器设置有多种条件(Yii controller setup with multiple conditions)

编程入门 行业动态 更新时间:2024-10-28 02:31:17
Yii控制器设置有多种条件(Yii controller setup with multiple conditions)

在Yii crud中,我根据名为Form的db表设置了Model,View和Controller。 到目前为止,我已根据自己的喜好修改了控制器和视图:

index.php/form/all (index) index.php/form/new (create) index.php/form/2 (view) index.php/form/2/edit (edit) index.php/form/2/delete (delete)

现在我想设置一些动态的子页面。 网址模式如下。 如何在FormController.php中设置它?

index.php/form/2/fields/all index.php/form/2/fields/new index.php/form/2/fields/1/edit index.php/form/2/fields/1/delete

BTW - Fields是一个单独的数据库表,具有单独的yii模型。 虽然如果我不需要,我想不为它创建一个控制器。

In Yii crud, I've setup a Model, View, and Controller based on my db table called Form. I've modified the controller and views to my liking thus far:

index.php/form/all (index) index.php/form/new (create) index.php/form/2 (view) index.php/form/2/edit (edit) index.php/form/2/delete (delete)

Now I'd like to setup some subpages that will be dynamic. The url patterns are below. How do I set this up inside of the FormController.php?

index.php/form/2/fields/all index.php/form/2/fields/new index.php/form/2/fields/1/edit index.php/form/2/fields/1/delete

BTW - Fields is a separate db table with a separate yii model. Though I'd like to not create a controller for it if I don't need to.

最满意答案

谢谢Neophile,我最后添加了一个字段控制器。 这是我完成的解决方案的链接: Yii用于多个控制器操作参数的URLManager规则

Thanks Neophile, I ended up adding a fields controller. Here is a link to my finished solution: Yii URLManager rule for multiple controller action parameters

更多推荐

本文发布于:2023-08-08 00:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466714.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有多种   控制器   条件   Yii   conditions

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!