输出前添加 <pre>,便可以自动格式化换行显示。
print_r("<pre>");
比如打印数组 : print_r($arr);
输出:
Array ( [0] => Array ( [volume] => id100343 [weight] => 4 ) [1] => Array ( [volume] => id100212 [weight] => 1 ) [2] => Array ( [volume] => id104104 [weight] => 10 ) )
添加<pre> 后,看起来就清晰很多
print_r("<pre>");
print_r($arr);
输出:
Array
(
[0] => Array
(
[volume] => id100343
[weight] => 4
)
[1] => Array
(
[volume] => id100212
[weight] => 1
)
[2] => Array
(
[volume] => id104104
[weight] => 10
)
)
————————————————
原文地址:https://www.cnblogs.com/lazb/p/11966102.html
时间: 2024-11-09 02:40:24