php之获取程序源码的方法

文件hello.php和index.php在同一目录

 

hello.php

<?php

class  hello{

    public function __construct()
    {
        echo 'hello world';
    }

}

index.php

$file = file('hello.php');
print_r($file);

输出结果为:

Array
(
    [0] => <?php

    [1] => 

    [2] => class  hello{

    [3] => 

    [4] =>     public function __construct()

    [5] =>     {

    [6] =>         echo 'hello world';

    [7] =>     }

    [8] => 

    [9] => }

)

 

posted @ 2015-05-11 11:44  yikai.shao  阅读(698)  评论(0编辑  收藏  举报