Display xml file cascaded contents in a drop down via php

江枫思渺然 提交于 2020-01-16 10:12:20

问题


I have a local xml file which I am trying to display over a webpage with following code.

All I get is a blank page.

enter code here

<?php
   $xml_content = file_get_contents("C:\Users\user\Downloads\93D7.xml");
   $data = simplexml_load_string($xml_content);
   foreach ($data->item as $item) {
      var_dump($item->bookname);
   }
?>

Once the display works, I want to have a drop down where I will select the xml element / entity and it will display the value or child of that element / entity.

Can someone help?

I referred : Get multiple items from XML with SimpleXML & populating dropdown with values from xml file in php

Both individually gives me a blank page.

来源:https://stackoverflow.com/questions/58808352/display-xml-file-cascaded-contents-in-a-drop-down-via-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!