Yii Framework Forum: Loadmodel的作用是什么 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Loadmodel的作用是什么 控制器里的loadModel的作用是什么 Rate Topic: -----

#1 User is offline   mars 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 07-February 13

Posted 18 February 2013 - 09:23 AM

在控制器里.像这样一段loadModel代码是加载模型数据还是加载模型对象. loadModel的功能是做什么的.麻烦能具体讲解下吗? 谢谢了

Attached File(s)


0

#2 User is offline   mars 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 07-February 13

Posted 20 February 2013 - 08:52 PM

有人帮忙求解吗?thanks
0

#3 User is offline   Alphaschao 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 19-February 13

Posted 21 February 2013 - 02:05 AM

View Postmars, on 18 February 2013 - 09:23 AM, said:

在控制器里.像这样一段loadModel代码是加载模型数据还是加载模型对象. loadModel的功能是做什么的.麻烦能具体讲解下吗? 谢谢了


通过$_GET[] 得到id $this->_model=Category::model()->findByPk($id); 通过id查得这条数据并付值给this—>_model
最后返回$this—>_model
也就是返回通过id查得到的数据
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users