get the sub index in foreach loop in simpleXMLElement

后端 未结 5 1078
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 13:38


  
    This is title1
    This is desc1         


        
5条回答
  •  醉话见心
    2020-12-19 14:30

    You can use a for loop instead of a foreach like this :

    $item = $xml->item;
    $howMany = count($item);
    for($i = 0; $i < $howMany; $i++){
    echo <<
                        
    13 Sep 2010
  • HTML; }

提交回复
热议问题