展会信息港展会大全

PHP中将文件载入数组 android软件开发教程
来源:互联网   发布日期:2016-03-02 15:46:41   浏览:1206次  

导读:使用file()函数将文件载入数组,文件中的每一行作为数组的一个元素。实例:array_file.php:view sourceprint?01.<?php02....

使用file()函数将文件载入数组,文件中的每一行作为数组的一个元素。

实例:

array_file.php:

view sourceprint?

01.<?php

02.$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];

03.?>

04.<html>

05.<head>

06.<title>Test Array File</title>

07.</head>

08.<body>

09.<?php

10.$peoples = file($DOCUMENT_ROOT.'/test/03/people.txt');

11.$count = count($peoples);

12.if ($count == 0) {

13.echo 'NO peoples pending. Please try again later.';

14.}

15.for ($i = 0; $i < $count; $i++) {

16.echo $peoples[$i].'<br />';

17.}

18.?>

19.</body>

20.</html>

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港