php_lang_ref:Language Reference >> References Explained >> Spotting References

来源:互联网 发布:淘宝新店怎么做推广 编辑:程序博客网 时间:2024/06/08 05:51
<?php// +----------------------------------------------------------------------// | Created by im-server.// +----------------------------------------------------------------------// | Language Reference >> References Explained >> Spotting References// +----------------------------------------------------------------------// | Author: alexander <gt199899@gmail.com>// +----------------------------------------------------------------------// | Datetime: 2017-07-16 18:44// +----------------------------------------------------------------------// | Perfect Is Shit// +----------------------------------------------------------------------/** * 许多 PHP 的语法结构是通过引用机制实现的。 * case1:global $var * case2:$this */namespace case1;$a = 1;function test(){    // 以下两种方式是等效的    global $a;    $b = &$GLOBALS['a'];}namespace case2;class test{    public $a = 1;    public function a()    {        return $this->a;    }}
阅读全文
1 0