3
首先对不起英语的朋友抱歉!通过Yii2上的其他字段进行过滤RESTful API
我在YII2中测试了一个RESTful API,它很容易创建,遵循official guide。但默认情况下(据我所知),我只能通过ID作为参数来获得特定的记录。
例如,假设我有以下的表称为人:
id, name, age, gender, email, phone
在这种情况下,我只能通过ID过滤器,像这样:http://myserver/api/persons/1
我需要知道如何以其他字段进行过滤,例如年龄或性别例如。
我的控制器:
class PersonController extends ActiveController
{
public $modelClass = 'app\models\Person';
}
谢谢!
它的工作! 非常感谢你! – jflizandro
不客气! –