将php文件读入文本文件

My Code is

$check=  get_text22('http://localhost:81/ci/',$numb);
file_put_contents('fail.txt', $check, FILE_APPEND);

function get_text22($filename,$id){
    $context=...
    $fp_load = fopen("$filename", "rb",false,$context);
    if ( $fp_load ){
        while ( !feof($fp_load) ){
            $content .= fgets($fp_load, 8192);
        }
        fclose($fp_load);
        return $content;
    }
}

Generate File fail.txt

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

    <link rel="icon" type="image/png" href="ci/assets/favicon.ico">
   ...

But This generate html file. I want it can generate php file without process how it written at server in <?php tag.

There are two ways to do this:

  1. Read the PHP file from your filesystem instead of the URL of the results of executing the PHP from your HTTP server.
  2. Configure the HTTP server running on localhost:81 to serve up PHP source code instead of executing it. i.e. Do the opposite of what this question suggests.

The first of those two options is the sensible one.