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] => }

)
原文地址:https://www.cnblogs.com/shaoyikai/p/4494121.html