时间:2021-07-01 10:21:17 帮助过:16人阅读
怎么显示就自己组织吧
$s = <<EOF;$x = simplexml_load_string($s);$data = [];foreach($x->Evaluations as $Evaluations){ foreach($Evaluations->Evaluation as $Evaluation){ $tmpData = current($Evaluation->attributes()->data); if(!isset($data["$tmpData"])){ $data["$tmpData"] = []; } foreach($Evaluation->OBJECT as $OBJECT){ $data["$tmpData"]["$OBJECT"] = current($OBJECT->attributes()->data); } }}print_r($data);/*Array( [植物系统] => Array ( [水果] => 苹果,梨 [乔木] => 竹子,富贵竹 [花类] => 菊花,康乃馨 [其他] => ) [动物系统] => Array ( [陆] => 老虎,狮子 [海] => 鱼,海马 [其他] => ))*/
怎么显示就自己组织吧
$s = <<EOF;$x = simplexml_load_string($s);$data = [];foreach($x->Evaluations as $Evaluations){ foreach($Evaluations->Evaluation as $Evaluation){ $tmpData = current($Evaluation->attributes()->data); if(!isset($data["$tmpData"])){ $data["$tmpData"] = []; } foreach($Evaluation->OBJECT as $OBJECT){ $data["$tmpData"]["$OBJECT"] = current($OBJECT->attributes()->data); } }}print_r($data);/*Array( [植物系统] => Array ( [水果] => 苹果,梨 [乔木] => 竹子,富贵竹 [花类] => 菊花,康乃馨 [其他] => ) [动物系统] => Array ( [陆] => 老虎,狮子 [海] => 鱼,海马 [其他] => ))*/
找不到网页....那是你服务器的错误吧,或者链接写错了...
找不到网页....那是你服务器的错误吧,或者链接写错了...
[] 是 php 5.4+ 的写法
分配到前台
$this->assign('data',$data);
怎么循环显示,要加什么样式 ...就是你的事了
http://document.thinkphp.cn/manual_3_2.html#volist