我是php的新手,只是学习一些技术,比如print,echo等等 我只是检查uClassify库,并输出文本:
Array
(
[0] => Array
(
[id] => Classify275941362830057
[classification] => Array
(
[0] => Array
(
[Klasifikasi] => NonOpini
[Nilai] => 0.121026
)
[1] => Array
(
[Klasifikasi] => Opini
[Nilai] => 0.878974
)
)
[Teks] => Yg ga pake im3 pasti nyesel .. Ckckck..kasian.. #dutapku -,-
)
)
如果我只是想这样打印出来:
[Klasifikasi] => NonOpini
[Nilai] => 0.121026
[Klasifikasi] => Opini
[Nilai] => 0.878974
这是上面原始代码的链接:https://github.com/ashwanthkumar/uClassify-PHP5/blob/master/uClassify.php
解释我,怎么做... thx求助:)
答案 0 :(得分:1)
foreach ($array[0]['classification'] as $a)
foreach ($a as $k => $v)
echo "[$k] => $v <br>";
答案 1 :(得分:0)
假设您的整个事物存储在名为$arr
的数组中
所以你会做类似下面的事情
<?php
foreach($arr[0]['classification'] as $new_array) {
foreach($new_array as $key=>$value) {
echo "[".$key."] => ".$value."<br>";
}
}
?>
希望这有助于