<?=$hello?>d等同于<? echo $hello;?>$hello是个对象怎么能ECHO呢 呵呵 错我提示很明显 这么写MVC还不如去看看源码

解决方案 »

  1.   

    哈哈,$hello 是对像,你直接输出当然有问题
      

  2.   

    楼上两位大哥,PHP里对象应该如何输出? 能否详细点? 小弟菜
      

  3.   

    test.func.php: 
    <?php 
    Class Hello 

    function HelloWorld() 

        return "Hello World!!!"; 


    ?> control.php 
    <?php 
    require_once ('test.func.php'); 
    $Hello = new Hello(); 
    $aHello=$Hello ->HelloWorld(); 
    include('view.html'); 
    ?> view.html 
    <html> 
    <head> 
    <title> </title> 
    </head> 
    <body> 
    <?=$aHello?> 
    </body> 
    </html>