1

ファイルからコード サンプルを実行せずにインクルードしたい。しかし、インクルードされたファイルの最初の 9 行をやなどの関数がカット
する理由がわかりません。fread()file_get_contents()

コードを実行せずに含める (私が試した多くの方法の 1 つ):

<?php
// get contents of a file into a string
$filename = "index_GD.php";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
echo "<pre><codesample>".$contents."</codesample></pre>";
fclose($handle);
?>


インクルード ファイルの最初の 11 行:

<?php

// Set the content-type
header('Content-Type: image/png');

function imagegradientellipse($image, $cx, $cy, $w, $h, $ic, $oc){
 $w = abs($w);
 $h = abs($h);
 $oc = array(0xFF & ($oc >> 0x10), 0xFF & ($oc >> 0x8), 0xFF & $oc);
 $ic = array(0xFF & ($ic >> 0x10), 0xFF & ($ic >> 0x8), 0xFF & $ic);
 $c0 = ($oc[0] - $ic[0]) / $w;


出力 (最初の 11 行):

 > 0x10), 0xFF & ($oc >> 0x8), 0xFF & $oc);
 $ic = array(0xFF & ($ic >> 0x10), 0xFF & ($ic >> 0x8), 0xFF & $ic);
 $c0 = ($oc[0] - $ic[0]) / $w;
 $c1 = ($oc[1] - $ic[1]) / $w;
 $c2 = ($oc[2] - $ic[2]) / $w;
 $i = 0;
 $j = 0;
 $is = ($w<$h)?($w/$h):1;
 $js = ($h<$w)?($h/$w):1;
 while(1){
4

1 に答える 1