| 类 myclass::abc()和$test->abc()的差异 |
|
|
| 2008-04-25 | ||||
|
[php] class myclass { var $username = ""; function show_username() { $this->username = "小明"; } function Welcome() { $this->show_username(); echo "欢迎".$this->username; } } [/PHP] 然后使用 myclass::Welcome(); 提示错误 Call to a member function on a non-object 使用 $msg = new myclass(); $msg -> Welcome(); 得到 欢迎小明 看来这两种方法用起来并非很随意,不知道大家注意到了没有?或是有其它要注意的地方。 发表评论
|
||||
| 下一篇 > |
|---|