mune
V2EX  ›  PHP

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

  •  
  •   mune · Oct 24, 2017 · 2170 views
    This topic created in 3143 days ago, the information mentioned may be changed or developed.
    class base{
    $_auth = 1;
    //构造函数
    __init(){
    $this -> _auth > 0 && $this -> a();
    }
    function a(){
    }
    }
    1 replies    2017-10-24 15:49:59 +08:00
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4913 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 09:53 · PVG 17:53 · LAX 02:53 · JFK 05:53
    ♥ Do have faith in what you're doing.