本帖最后由 greenbluede 于 2010-09-24 15:55:53 编辑

解决方案 »

  1.   

    <root u="http://hi.dd.com"> <list p="http://img.com/img/logo-hi.gif" w="137" h="46"> <u><![CDATA[http://hi.bdu.com]]></u> </list> <list p="http://tx.bdu.com/sys/portrait/item/1948c1f8d4c2d7d36408.jpg" s="女" a="12" m="未知" l="上海" w="110" h="110"> <u><![CDATA[/mimi%5Fshi8]]></u> <id><![CDATA[柳月]]></id> <c><![CDATA[废话不多说,]]></c> </list>
    </root>再问一下 如果用 javascript 取得   废话不多说, 的这个值? 
      

  2.   

    $add="http://hi.baidu.com/sys/file/moreonline.xml";
    $hand=fopen($add,"r") or die("连接失败......请重试!");
    $fcontents=file_get_contents($add);
    $f_name="online.xml";
    iconv('gb2312','gb2312',$fcontents);
    #$xl=simplexml_load_string($fcontents);
    var_dump($xl);
    var_dump($fcontents);
    #iconv('utf-8','gb2312',$fcontents);
    //$fw=fopen("online.xml","w"); //去掉fopen,w模式打开的话会锁住文件
    //fwrite($fw,$fcontents);
    $xml=simplexml_load_file("online.xml");
    var_dump($xml);
      

  3.   

    回复 4楼:
              还是不行,我想改 javascript 写   如何 用 javascript 取得上面 xml文件中  废话不多说的这个值?
      

  4.   

    simplexml 只接受 utf-8 编码的文档$add="http://hi.baidu.com/sys/file/moreonline.xml";
    $hand=fopen($add,"r") or die("连接失败......请重试!");
    $fcontents=file_get_contents($add);
    $f_name="online.xml";
    iconv('gb2312','utf-8',$fcontents);
    #$xl=simplexml_load_string($fcontents);
    var_dump($xl);
    var_dump($fcontents);
    #iconv('utf-8','gb2312',$fcontents);
    $fw=fopen("online.xml","w");
    fwrite($fw,$fcontents);
    $xml=simplexml_load_file("online.xml");
    var_dump($xml);
      

  5.   

    $hand=fopen($add,"r") or die("连接失败......请重试!");
    你要这句做什么?你用iconv做什么?
    iconv('gb2312','gb2312',$fcontents);
    gb2312转gb2312?
    一开始不用转,把这个注掉。