javascript与php观察者模式

  1. JAVASCRIPT:
    a. 代码:
    var a = function(){
    this.int = 0
    this.add = function(int){
        this.int = int
    }
    this.watch = function(){
        if(this.int==0){
            console.log('0')
        }else{
            console.log('not 0')
        }
    }
    }
    var a = new a()
    a.watch()
    a.add(1)
    a.watch()

    b. 输出:

    成都创新互联公司-专业网站定制、快速模板网站建设、高性价比扎赉诺尔网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式扎赉诺尔网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖扎赉诺尔地区。费用合理售后完善,十余年实体公司更值得信赖。

    0
    not 0
  2. PHP:
    a. 代码:
    int += $int;
    }
    public function watch(){
        if($this->int==0){
            echo "0".PHP_EOL;
        }else{
            echo "not 0".PHP_EOL;
        }
    }
    }
    $a = new a();
    $a->watch();
    $a->add(1);
    $a->watch();

    b. 输出:

    0
    not 0

分享题目:javascript与php观察者模式
本文地址:http://lszwz.com/article/jppddp.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款