判断是否登录时页面出错,怎么解决?
星河4p
星河4p 2017-08-16 09:08:58
0
4
1258

<?php
namespace app\index\controller;
use app\index\controller\Base;
class Index extends Base
{
   public function index()
   {
       $this->isLogin();   //判断用户是否登录
       return $this->view->fetch();
   }
}

星河4p
星河4p

嗯哼

全部回复(3)
糊涂斌

$this->isLogin();

isLogin()这个方法不在你的类里面;你要在类里面新增一个isLogin();$this->是用来获取当前对象的非静态属性用的例如:

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


  • 回复 回答不对
    鸢尾花 作者 2018-01-03 18:57:03
ringa_lee

那就肯定是这个方法有问题了,isLogin()

越努力,越幸运

加了下面这一句,页面就出错了

$this->isLogin();   //判断用户是否登录

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!