且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

php评估后的PHP file_get_contents

更新时间:2023-02-23 21:40:31

参见示例手册中的#5和#6。从那里直接采取:

See examples #5 and #6 on the manual. Taken straight from there:

$string = get_include_contents('somefile.php');

function get_include_contents($filename) {
    if (is_file($filename)) {
        ob_start();
        include $filename;
        $contents = ob_get_contents();
        ob_end_clean();
        return $contents;
    }
    return false;
}