<?php
namespace app\index\controller;
use app\index\controller\Base;
class Index extends Base
{
? ?public function index()
? ?{
? ? ? ?$this->isLogin(); ? //判斷使用者是否登入
? ? ? ?return $this->view->fetch();
? ?return $this->view->fetch();
? ?return##}#
嗯哼
$this->isLogin();
isLogin()這個方法不在你的類別裡面;你要在類別裡面新增一個isLogin();$this->是用來取得目前物件的非靜態(tài)屬性用的例如:
class?Index?extends?Base { ???public?function?index() ???{ ???????$this->isLogin();???//判斷用戶是否登錄 ???????return?$this->view->fetch(); ???} ???public?isLogin(){ ???????#code?判斷用戶是否登錄 ???} }