search

Home  >  Q&A  >  body text

There is an error on the page when logging in. How to solve it?

<?php
namespace app\index\controller;
use app\index\controller\Base;
class Index extends Base
{
public function index()
{
          $this->isLogin();     // Determine whether the user is logged in
                                                                                                                     .

星河4p星河4p2699 days ago1330

reply all(4)I'll reply

  • 糊涂斌

    糊涂斌2017-08-30 11:25:53

    $this->isLogin();

    isLogin() This method is not in your class; you need to add a new isLogin();$this-> in the class to obtain the non-static properties of the current object For example:

    class Index extends Base
    {
       public function index()
       {
           $this->isLogin();   //判断用户是否登录
           return $this->view->fetch();
       }
       public isLogin(){
           #code 判断用户是否登录
       }
    }


    reply
    0
  • 鸢尾花

    Wrong answer

    鸢尾花 · 2018-01-03 18:57:03
  • ringa_lee

    ringa_lee2017-08-16 13:34:21

    Then there must be something wrong with this method, isLogin()

    reply
    0
  • 星河4p

    星河4p2017-08-16 09:09:53

    After adding the following sentence, the page is wrong

    $this->isLogin(); //Determine whether the user is logged in

    reply
    0
  • Cancelreply