我的环境是 PHP Version 5.1.6+linux,
可 simplexml_load_file 这个函数用不了,可能是php版本或是配制文件设置的问题,
现想把 这个函数设为可用,应该怎么设置呀,thanks

解决方案 »

  1.   

    在你的php.ini里面查找扩展是否开启!
      

  2.   

    好像内置吧?待会儿去官方查一下用了simplexml_load_file 提示啥。这个应该需要allow_url_fopen = On
      

  3.   

    多谢大家
    1 在php.ini文件中  allow_url_fopen = On  是这样的
    2 我运行 
    $xml = simplexml_load_file('a.xml');
    print_r($xml);
    出现在结果是:SimpleXMLElement Object ( [SecondHouse] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 217045 [userid] => jtzy [password] => 123456 [del] => 0 ) [House] => 3-2-2 [AddDate] => 2010-11-2 16:35:08 ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 217042 [userid] => jtzy [password] => 123456 [del] => 0 ) [House] => 3-2-1 [AddDate] => 2010-11-2 16:30:56 ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 217041 [userid] => jtzy [password] => 123456 [del] => 0 ) [House] => 2-2-1 [AddDate] => 2010-11-2 16:19:06 ) ) ) 现我要取 [House]  [AddDate] 二个的值,并把这二个值放入二维数组中,怎么取呀,
      

  4.   

    $xml = simplexml_load_file('a.xml');
    foreach($xml->SecondHouse as $v)
    {
      echo $v->House.'<br/>';
      echo $v->AddDate.'<br/>';
    }
    可以了