Home > Backend Development > PHP Tutorial > 使用Yii生成的类与自己new出来有什么区别呢?

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:45:18
Original
1003 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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template