fopen() 函数 直接打开文件
例
$file = "111.txt"; $fp = fopen($file,"r"); if ($fp){ while(!feof($fp)){ //第二个参数为读取的长度 $data = fread($fp, 1000); } fclose($fp); } echo $data; ?>
file_get_contents() 函数把整个文件读入一个字符串中
例子
echo file_get_contents("test.txt"); ?>
输出:
This is a test file with test text.
php读取本地文件夹文件
$dir = opendir('/movie'); while(($file = readdir($dir))!=false){ if ($file!="." && $file!="..") { $ns = explode('.', $file); echo $ns[0]; } } closedir($dir);
?>
大道仙途炼丹炼器玩法详解指南
《The Expanse》创作者不想陷入《Star Wars》式的窠臼
《Pokémon Pokopia》更新扩展了移动宝可梦中心的功能
《Vampire Crawlers》评测 这部《吸血鬼幸存者》的卡牌构建衍生作同样极具创意
todo清单已完成如何操作
噩梦山峦技能讲解攻略(掌握噩梦山峦技能的关键要点)
轮船斜坡大冲刺
特格拉生存
MWT坦克大战
暴躁兔子模拟
太空计划
小生活世界
重型施工模拟器
模拟北极熊岛
我的小鲨鱼warma