mune
V2EX  ›  PHP

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

  •  
  •   mune · Oct 24, 2017 · 2530 views
    This topic created in 3303 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   ·   Privacy   ·   Solana   ·   4589 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 67ms · UTC 08:55 · PVG 16:55 · LAX 00:55 · JFK 03:55
    ♥ Do have faith in what you're doing.