【问题标题】:Query limitation in DBO (Joomla 3.8.1)DBO 中的查询限制 (Joomla 3.8.1)
【发布时间】:2018-04-18 00:02:37
【问题描述】:

我使用 JDatabaseDriver 与数据库交互。 我从官方 Joomla 文档中获取的下一个代码。 Documentation

// Get a db connection.
$db = JFactory::getDbo();

// Create a new query object.
$query = $db->getQuery(true);
$query
    ->select($db->quoteName(array('user_id', 'profile_key', 'profile_value', 'ordering')))
    ->from($db->quoteName('#__user_profiles'))
    ->setLimit('10');

查看上面代码中的最后一行。 setlimit 方法在 JDatabaseDriver 类中不存在,但它在类 - JDatabaseQueryMysqli 中声明。 是不是我没看懂逻辑还是有什么错误?

【问题讨论】:

    标签: database joomla dbo


    【解决方案1】:

    在最新的 Joomla 3.8.1 中,setLIMIT 无法正常工作。您可以选择其他方法,例如 $query->setQuery($query,start,offset);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多