【发布时间】:2014-07-17 15:25:32
【问题描述】:
我正在从 0 开始在新论坛的新项目中工作,我想添加一个不错的方法和...等 1.第一: 我试图在一个类中调用一个文件的类,我的意思是: 例如,我有一个文件 class.php 和 auther main.php 和 index.php 在 class.php 中创建我的类,在 main.php 中创建 auther 类 main ,在我使用类之类的函数之后,我包含在 class.php 中......
class.php:
<?PHP
class test{
function hello(){ echo "Hello World !"; }
}
?>
main.php
<?PHP
class main{
function _test_(){
require_once("class.php");
return new test();
}
function __destruct(){
echo "good bye";
}
}
index.php:
<?PHP
include_once("main.php");
$main = new main();
$main->_test_()->hello();
echo "<br> what !!!!???? <br>";
?>
现在是结果:
Hello World !
what !!!!????
good bye
我想知道为什么在 Hello World 结果后没有出现类破坏?? ?>
【问题讨论】:
-
"destruct" -- 你在那个脚本中做了什么吗?不。所以在脚本开始退出之前,您的对象不会被销毁。