getState()函数在组件Model类下的工作方式


How the getState() function work under the component Model class?

Under/components/com_content/models/category.php

function getItems()
{
    $params = $this->getState()->get('params');
    $limit = $this->getState('list.limit');
    // other code

getItems()函数中,有一个名为getState()的函数,它有一个参数list.limit。我想问list.limit的含义是什么,getSatae()函数是如何工作的?它可以通过参数执行,也可以不通过参数执行。什么时候使用其中一个?

感谢

此函数位于/libraries/joomla/application/component/model.php的第395行函数通知几乎不言自明。

它的基本模型功能(Joomla是基于MVC架构)来获取状态变量。状态对象是变量的存储。(默认无)

例如,list.limit定义页面上的项目数。

Joomla文档或Joomla MVC类中的更多信息