<?php $aaa = file_get_contents("names.txt"); $data = explode(" ", $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>