Skip to content

在同一个方法中调用两个不同的$model 时, 后面的那个无法正常调用 #139

@3DMXM

Description

@3DMXM

我创建了两个 model,一个 redis 缓存相关, 一个 user 用户相关。
经过测试,如果只单独使用其中一个,没有问题,但如果两个混合使用,后面的那个model无法正常定位到方法。
如果把前面的 $data = App::$model->redis->GetWikiDataForPath($path); 注释掉,
后面的 $user_id = App::$model->user->GetUserId(); 就能正常获取到用户id了,
但如果前面的存在,后面的就会报错找不到 GetUserId 方法,原因是因为它去 redis 里面找的 。
将两个方法反过来, 如果先用 App::$model->user 之后,再调用 App::$model->redis ,它则会去 user 里面去找 redis 的方法,

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions