Posted in Javascript onMarch 21, 2018
1.JAVASCRIPT:
a. 代码:
var a = function(){ } var my_a = new a() my_a.say = function(){ console.log('hello') } my_a.say()
b. 输出:
hello
2. PHP:
a. 代码:
<?php class a{ } $a = new a(); $a->say = function(){ echo "hello"; }; $say = $a->say; $say();
b. 输出:
hello
javascript与PHP动态往类中添加方法对比
- Author -
Lee_吉声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@