PHP Code - import xml file from web server (/public_html/ctrackxml) into mysql database

前端 未结 5 1733
无人共我
无人共我 2021-01-07 02:26

I have xml files been imported onto an FTP server. This is stored in location \'/public_html/ctrackxml/\' with a random file name and in the following format:



        
5条回答
  •  天命终不由人
    2021-01-07 02:56

    Browsing your code it looks like the following:

    foreach ($message->message as $message) {
    

    should actually be:

    foreach ($library->message as $message) {
    

    $library contains your XML object so it should be the one you are accessing and not the, as yet, unitialised $message variable.

    Were $message initialised your current code would actually wipe itself out with each iteration of the for loop because it assigns its child element to itself!

提交回复
热议问题