Home > PHP > 【PHP】 file_get_contentsで躓いた

【PHP】 file_get_contentsで躓いた

会社でやってて躓いた(半月ほど前に

下記の /hoge.php を /fuga.php から呼び出すとして。

hoge.php

<?php
  echo 'hogafuge';
?>

fuga.php

<?php
  $file1 = file_get_contents('./hoge.php');
  $file2 = file_get_contents('http://unolabo.boo.jp/hoge.php');
?>

$file1 , $file2 それぞれの出力は、

echo $file1;

<?php
  echo 'hogafuge';
?>

echo $file2;

hogefuga

と、なるらしい。べんり

最初 $file1 のほうでやっててできません!てなったんだけど、 $file2 でやると出力結果が取れるんですよ、と言われました。(Apachがどうとかっていう説明と共に

でも、readfile(); でも同じなのかすら・・

とりあえず眠いのでまたこんど。

Comments:0

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://unolabo.boo.jp/archives/2009/10/10-file_get_contents%e3%81%a7%e8%ba%93%e3%81%84%e3%81%9f.html/trackback
Listed below are links to weblogs that reference
【PHP】 file_get_contentsで躓いた from うのらぼ。

Home > PHP > 【PHP】 file_get_contentsで躓いた

Search
Feeds
Meta

Return to page top