V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
mune
V2EX  ›  PHP

一个基础类,目前是 基类的类属性 _auth 控制继承自它的子类是否需要执行基类的方法 a , 可以怎样在其子类的某个方法中控制 a 是否执行?大家有好的方法吗?类似:

  •  
  •   mune · 2017 年 10 月 24 日 · 2001 次点击
    这是一个创建于 3019 天前的主题,其中的信息可能已经有所发展或是发生改变。
    class base{
    $_auth = 1;
    //构造函数
    __init(){
    $this -> _auth > 0 && $this -> a();
    }
    function a(){
    }
    }
    1 条回复    2017-10-24 15:49:59 +08:00
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1167 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:00 · PVG 02:00 · LAX 10:00 · JFK 13:00
    ♥ Do have faith in what you're doing.