hhnf333 发表于 2018-12-12 09:50:50

javascript与php观察者模式


[*]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. 输出:

0
not 0
[*]PHP:
a. 代码:
页: [1]
查看完整版本: javascript与php观察者模式