Home  >  Article  >  Backend Development  >  PHP 种对象

PHP 种对象

WBOY
WBOYOriginal
2016-06-13 13:15:28882browse

PHP 类对象
在一个类里面实例化一个或者多个类,那样子会不会占用很大的系统资源啊!还有的就是一个PHP程序占用资源的多少,是怎么看出来的!本人菜鸟一个,希望大神们帮忙看看!谢谢!
class a
{
  public $var_a; 
  public $var_b; 
  public function ini()
  {
  $this->var_a = new b;
  $this->var_a = new c;
  }
}
class b
{
  public $var_a; 
  public $var_b; 
}
class c
{
  public $var_a; 
  public $var_b; 
}

------解决方案--------------------
没关系,
页面执行完成后
PHP自动销毁所有使用资源
------解决方案--------------------
linux下查看php占用多少资源用top命令,windows下看资源管理器进程情况
------解决方案--------------------
memory_get_usage();
------解决方案--------------------
linux下查看php占用多少资源用top命令,windows下看资源管理器进程情况
也可以 memory_get_usage(); 都能看资源的占用率
------解决方案--------------------
析构函数是在对象被销毁时执行的,而不是用来销毁对象的


你可能理解错了吧?

Statement:
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
Previous article: cooking解决方法 Next article: PHP代码式样