search

Home  >  Q&A  >  body text

In the thinkphp5 course, using paginate() in the controller prompts that the attributes of the class do not exist.

Video Tutorial http://www.php.cn/course/631.html In Chapter 5, Section 3, use paging to display classification information. In this video,

according to the video Write $cate_list=Menu::paginate(10); when used on the template page, it will prompt that the attribute of class

does not exist: app\menu\model\Menu->id

The namespace and think references are the same as in the previous section

$cate=Menu::getTree(); You can use

$cate_list= on the template page Menu::paginate(10); will report an error when used in a template


北岛初晴北岛初晴2564 days ago1974

reply all(2)I'll reply

  • 北岛初晴

    北岛初晴2017-11-20 12:24:58

    menu:: is the class Menu in the model and is written in the controller as Menu::method();

    reply
    0
  • 又白又帅又可爱

    又白又帅又可爱2017-11-20 11:43:07

    $cate_list=Menu::paginate(10);

    I don’t know what the Menu here is.

    The object must be obtained before calling paginate(10), that is to say You need to query first and then paginate the result objects

    reply
    0
  • Cancelreply