<?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
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?.
嗯哼
$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?判斷用戶是否登錄 ???} }
After adding the following sentence, the page is wrong
$this->isLogin(); //Determine whether the user is logged in