使用Yii生成的类与自己new出来有什么区别呢?

WBOY
Release: 2016-06-06 20:45:18
Original
911 people have browsed it

比如缩略图类:
$thumb = Yii::app()->thumb;
与 $thumb=new Cthumb()有什么区别?
是对象销毁的时候有区别吗?

回复内容:

比如缩略图类:
$thumb = Yii::app()->thumb;
与 $thumb=new Cthumb()有什么区别?
是对象销毁的时候有区别吗?

前者每次引用的是同一对象。
后者(你自己创建的),你每次创建的对象,都是单独的。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!