开发者

how to use another-model in a controller?

开发者 https://www.devze.com 2023-03-10 00:21 出处:网络
i want to use another model in a controll开发者_开发问答er for example in users_controller.php,we use a model as User how i can use another model for example sports_controller model as Sport?In your c

i want to use another model in a controll开发者_开发问答er for example in users_controller.php,we use a model as User how i can use another model for example sports_controller model as Sport?


In your controller:

$this -> loadModel ('Sports');

Then you can use it like any other model:

$this -> Sports -> find ('all');
0

精彩评论

暂无评论...
验证码 换一张
取 消