通过PHP来 获取文件内容 并且分割字符串 呈现在表格中
时间:2019-03-16
本文章向大家介绍通过PHP来 获取文件内容 并且分割字符串 呈现在表格中,主要包括通过PHP来 获取文件内容 并且分割字符串 呈现在表格中使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
<?php $aaa = file_get_contents("names.txt"); $data = explode("\n", $aaa); foreach ($data as $key) { if (!$key) continue; else { $col = explode('|', $key); $final[] = $col; } } ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> table td { text-align: center; } </style> </head> <body> <div> <table> <thead> <tr> <td>编号</td> <td>姓名</td> <td>年龄</td> <td>邮箱</td> <td>网址</td> </tr> </thead> <tbody> <?php foreach ($final as $item): ?> <tr> <?php foreach ($item as $val): ?> <?php $temp = trim($val); ?> <?php if (strpos($temp, 'http://') === 0): ?> <td><a href="<?php echo strtolower($temp) ?>"><?php echo substr($temp,7) ?></a></td> <?php else : ?> <td><?php echo $val; ?></td> <?php endif ?> <?php endforeach ?> <?php endforeach ?> </tbody> </table> </div> </body> </html>
- 左手用R右手Python系列之——数据框与apply向量运算
- 左手用R右手Python系列之——迭代器与迭代对象
- 【关关的刷题日记61】Leetcode 102. Binary Tree Level Order Traversal
- 【关关的刷题日记62】Leetcode 104. Maximum Depth of Binary Tree
- DataAnnotations - InverseProperty Attribute:
- 【关关的刷题日记63】Leetcode 111 Minimum Depth of Binary Tree
- Configure Many-to-Many relationship:
- 【关关的刷题日记64】Leetcode 110 Balanced Binary Tree
- 左手用R右手Python系列之——json序列化与反序列化
- 【干货】GAN调研:多极扩展(跨域和条件的GAN扩展模型调研)
- 【干货】TensorFlow实战——图像分类神经网络模型
- HTML5手机APP开发入(5)
- 这种自带黑科技的R包,请给我来一打
- 4927 线段树练习5
- php概述
- php教程
- php环境搭建
- PHP书写格式
- php变量
- php常量
- PHP注释
- php数组
- php字符串 string
- PHP整型 integer
- PHP浮点型 float
- php布尔型
- php数据类型之数组
- php数据类型之对象
- php数据类型之null
- php数据类型之间的转换
- php运算符
- php表达式
- PHP循环控制
- PHP流程控制
- php函数
- php全局变量
- PHP魔术变量
- php命名空间
- php 日期
- PHP包含文件
- php文件
- PHP 文件上传
- php Cookies
- php Sessions
- php email
- php安全email
- php错误处理
- PHP异常处理
- php过滤器
- PHP 高级过滤器
- php json
- php 表单
- PHP MySQL 简介
- PHP 连接 MySQL
- php创建数据库
- php 创建表
- php mysq 插入数据
- PHP MySQL 插入多条数据
- PHP MySQL 预处理语句
- php mysql 读取数据
- php mysql where
- PHP MySQL Order By
- PHP MySQL Update
- PHP MySQL Delete
- php ODBC
- Leetcode 1483. 树节点的第 K 个祖先(DP,倍增)
- Mybatis 使用通用 mapper
- Mybatis-Plus 的简单使用
- Mybatis-Plus 条件构造器
- Nginx 反向代理
- 非关系型数据库 Redis
- MyBatis 简单使用
- 数值分析常见习题解答
- Spring Web MVC 文件上传
- Leetcode 45 跳跃游戏 II (贪心+数学)
- Leetcode 第23场双周赛D 5363. 做菜顺序(DP,贪心)
- Leetcode 22. 括号生成 (括号匹配,dfs)
- MQ 系列之 ActiveMQ 介绍
- Python Tips(1) 数字与字符串之间转换,采用内置函数
- Spring Web MVC 拦截器