Skip to content

Thinkphp6.0.12分页+缓存导致致命错误 #2711

Open
@zjkal

Description

@zjkal

版本号: Thinkphp6.0.12
废话不说, 直接上代码

Db::name('project_comment')->json(['img'])->where('pid', '=', $project_id)->order('id', 'desc')->cacheAlways('test_key',Time::secondDay())->paginate(['list_rows' => 15, 'query' => request()->param()])

这个代码里, 同时使用了paginate和cache以后, 只要自定义cache的key, 就会报错.如果不自定义key就是正常的.
错误如下:
#0 [0]TypeError in PDOConnection.php line 695
think\db\PDOConnection::pdoQuery(): Return value must be of type array, string returned

   if ($query->getOptions('cache')) {
            // 检查查询缓存
            $cacheItem = $this->parseCache($query, $query->getOptions('cache'));
            $key       = $cacheItem->getKey();
            $data = $this->cache->get($key);
            if (null !== $data) {
                return $data;
            }
        }
        if ($sql instanceof Closure) {
            $sql  = $sql($query);
            $bind = $query->getBind();
        }
        if (!isset($master)) {

致命错误,静待更新. 需要了解其他情况, 请随时联系我.
QQ:252333696
Email:[email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions