教学视频4中的_construct()

浏览:566 发布日期:2013/06/15 分类:求助交流 关键字: construct 构造函数
我根据教程,在单一入口文件index.php中添加Index类的构造函数:_construct(){echo '我被实例化了';}
但是打开localhost/think/index.php后却没有这样的输出。这是为什么?
完整的代码如下:
<?php
$control = isset($_GET['m'])? $_GET['m'] : 'Index';

$obj = new $control();
class Index{
function _construct(){
echo '我被实例化了';
}
}
?>
最佳答案
评论( 相关
后面还有条评论,点击查看>>