窝窝插件 发表于 2015-8-26 14:58:55

php生成XML

//根据图片生成XML
$xml_path = ROOT_DIR.DIRECTORY_SEPARATOR.'/hrcms/Tpl/default/Community/xml';

if(!is_dir($xml_path)){
mk_dir($xml_path,0777);
}

$xmlFile = fopen($xml_path."/$news_id.xml", "wb+");
/http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:DOCUME~1ADMINI~1LOCALS~1Tempar_dump($feedFile);exit;
if ($xmlFile) {

$strxml.= &quot;<content width=\&quot;431\&quot; height=\&quot;542\&quot; >&quot;;

//封面
$strxml.=&quot;\t\r<page src=\&quot;&quot;.SITE_URL.&quot;/hrcms/Tpl/default/img/feng2.jpg&quot;.&quot;\&quot;/>\t\r&quot;;
foreach ($image_arr as $v){
$ni_name = $v[&quot;ni_name&quot;];
$strxml.=&quot;\t\r<page src=\&quot;&quot;.SITE_URL.&quot;/&quot;.$ni_name.&quot;\&quot;/>\t\r&quot;;
}
$strxml.=&quot;\t\r<page src=\&quot;&quot;.SITE_URL.&quot;/hrcms/Tpl/default/img/fengdi1.jpg&quot;.&quot;\&quot;/>\t\r&quot;;
$strxml.= &quot;\t\r</content>&quot;;
@fwrite($xmlFile,$strxml);
@fclose($xmlFile);
} else {
$this->error(&quot;XML文件写入失败,请检查相关权限&quot;);
}
页: [1]
查看完整版本: php生成XML