Home  >  Q&A  >  body text

Thinkphp 5.1 model obtains original data problem


$data = MallUser::where(true)->getData();
return $this->success('获取数据成功',$data);

1562745084(1).jpg

Using thinkphp 5.1.37 LTS version, I need to query the original data of the data, because the model uses a getter, use the model getData () method appears, the previously used tp5.0 is no problem. After comparing the model source code of the two versions, it is indeed true that this version does not have this method. Why does this method need to be removed from this version? Is there any way to achieve this?

文1902 days ago1591

reply all(2)I'll reply

  • 郑小飒

    郑小飒2019-07-11 16:29:19

    Encapsulate the getData query method in the model yourself. The TP5 model class does not have this method.

    reply
    0
  • 文

    After carefully looking at the source code, I realized that I was stupid. It turns out that this method exists, but it needs to be instantiated before it can be called. Many things are not found in the manual. Alas...

    · 2019-07-11 16:50:42
  • Cancelreply