本帖最后由 dz215136304 于 2012-06-04 13:41:29 编辑

解决方案 »

  1.   

    include啊, 怎么获取不到.[User:root Time:13:47:45 Path:/home/liangdong/php]$ php a.php 
    hello php[User:root Time:13:47:48 Path:/home/liangdong/php]$ cat a.php 
    <?php
    class main {
            public function __toString() {
                    include('b.php');
                    return $a;
            }
    }$main = new main();
    echo $main;
    ?><?php
    $a = "hello php";
    ?>
      

  2.   

    首先类名不能以数字开头。
    class abc123{
    public function index(){
           include "index.php";
    echo $abc;

    }}
    $a=new abc123;
    $a->index();
      

  3.   

    很可能是你的include中的路径不对,这样试试:include(dirname(__FILE__)."/b.php");