PHP封装一个echo函数, 字符串前自动加"\t"; 字符串结尾自动加.PHP_EOL 制表符:
//用法 echoTab('abcdefg;', 2);
//默认一个制表符 "\t", #tab为缩进制表符数量;
function echoTab($data, $tab = 1) { $data = str_repeat("\t", $tab).$data.PHP_EOL; echo $data; }
显示效果:标签:PHP,封装,函数,echo,tab,制表符,data From: https://www.cnblogs.com/zhouein/p/18281140
<table border = "1" style = "" cellspacing = "0"> <tr style = "text-align: center; height: 40px;"> <th style = "">统计时间</th> <th style = "">上期读数</th> <th style = "">本期读数</th> <th style = "">用量</th> <th style = "">金额</th> <th style = "width: 250px;">备注</th> </tr> <tr style = "text-align: center; background: #f5f5f5;"> <td style = "">20240701</td> <td style = "padding: 0 40px;">40,002.0</td> <td style = "padding: 0 40px;">45,607.0</td> <td style = "padding: 0 40px;">5,605.0</td> <td style = "padding: 0 40px;">24,662.00</td> <td style = "">商业综合 : 5605 * 4.4 = 24662</td> </tr> <table>