<?php
$top = "../top.txt";
$middle = "../middle.txt";
$bottom = "../bottom.txt";
$end = "/st.txt";
$data = "/dt.txt";
$handle1 = fopen($top, "r");
$contents1 = fread($handle1, filesize($top));
fclose($handle1);
$handle2 = fopen($end, "r");
$contents2 = fread($handle2, filesize($end));
fclose($handle2);
$handle3 = fopen($middle, "r");
$contents3 = fread($handle3, filesize($middle));
fclose($handle3);
$handle4 = fopen($data, "r");
$contents4 = fread($handle4, filesize($data));
fclose($handle4);
$handle5 = fopen($bottom, "r");
$contents5 = fread($handle5, filesize($bottom));
fclose($handle5);
echo $contents1;
echo $contents2;
echo $contents3;
echo $contents4;
echo $contents5;
?>
我得到這些錯誤爲他們每個人:閱讀與PHP文件 - 的fopen/FREAD
警告:的fopen(../ top.txt)[function.fopen]:未能打開流:沒有這樣的文件或目錄
警告:文件大小()[function.filesize]:STAT失敗../top.txt
警告:的fread():提供的參數是不是一個有效流資源
警告:FCLOSE():提供的參數是不是一個有效的流資源
文件模式中的所有文件和文件夾,並設置爲777
存在於服務器上的所有文件
PHP5安裝在服務器上
我在做什麼錯?
['file_get_contents()'](http://php.net/file_get_contents)可能是你感興趣的。 – mario 2012-08-08 22:08:05
檢查[include_path](http://us2.php.net/manual/en/function.get-include-path.php)和[open_basedir](http://www.php.net/manual/en/ini .core.php#ini.open-BASEDIR) – ghbarratt 2012-08-08 22:08:52