PHP笔记

119 阅读1分钟
    /**
     * 构造方法
     *
     * 对象创建时被自动调用
     */
    public function __construct()

    /**
     *析构方法
     * 对象被销毁时自动调用
     */
    public function __destruct()

unset($obj)    手动释放对象
const          表示局部类常量               const ONE = 1;
define()       表示全局常量
this           表示当前类的对象          $this->__construct();
self           表示当前类               const  TWO = self::ONE+1;
final          表示当前类不能被继承也不能重写方法    
final class Father{    //此时Father类不能被继承
    final function method{    //此时method不能被重写
    }
}
use function venter\func as newFunc    表示给命名空间下的func重新命名为newFunc
clone          对象深拷贝(拷贝新的内存)          $b = clone $a;
trait          代替多继承