假设我有一个带有几个条目的名为 names 的excel xlsx文档,并希望从php文件中打印出名称。
include 'simplexlsx.class.php';
$xlsx = new SimpleXLSX('names.xlsx');
print_r( $xlsx->rows() );
这将打印:
数组([0] =>数组([0] =>约翰[1] =>史密斯)[1] =>数组([0] =>史蒂文[1] =>刹车)[2] =>数组([0] =>卡特[1] => Firen)[3] =>数组([0] => Juan [1] => Lahyno)[4] =>数组([0] =>莎拉 [1] =>帕克)[5] =>数组([0] => Julie [1] =>罗伯茨)[6] => 数组([0] =>将[1] =>史密斯)[7] =>数组([0] =>安吉丽娜[1] =>朱莉))
有没有办法以可读的方式打印出数据?或者print_r不允许格式化传递给它的数组?
答案 0 :(得分:0)
如果你添加
echo '<pre>';
print_r( $xlsx->rows() );
然后你会看到类似的东西:
Array (
[0] => Array
(
[0] => John [1] => Smith
)
[1] => Array
(
[0] => Steven [1] => Brake
)
...
我希望这会对你有所帮助