根据地址组成规律生成sitemap.xml文件 \r\n ";fwrite($handle, $str);$sitemap="\r\n \r\n http://www.0349.org.cn/ \r\n $time \r\n $cq \r\n $p \r\n \r\n";if(!fwrite($handle, $sitemap)){echo "写入错误!";}break;case '2':$p=0.8;for
\r\n"; fwrite($handle, $str); $sitemap="\r\n \r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } break; case '2': $p=0.8; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/p/'.$v.'/'; $sitemap="http://www.0349.org.cn/ \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; case '3': $p=0.8; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/p/'.$v.'.html'; $sitemap="$v \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; case '4': $p=0.7; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/n/'.$v.'.html'; $sitemap="$v \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; case '5': $p=0.6; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/'.$v.'/'; $sitemap="$v \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; case '6': $p=0.6; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/'.$v.'/'; $sitemap="$v \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; case '7': $p=0.6; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/'.$v; $sitemap="$v \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; case '8': $p=0.5; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/'.$v.'/'; $sitemap="$v \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; case '9': $p=0.5; foreach ($arr as $key => $v) { $v='http://www.0349.org.cn/'.$v.'/'; $sitemap="$v \r\n$time \r\n$cq \r\n$p \r\n\r\n \r\n"; if(!fwrite($handle, $sitemap)){ echo "写入错误!"; } } break; default: # code... break; } } // $homexx=DB::getarray("select * from `#__product` where 1 "); // foreach ($homexx as $k => $v) { // } //写入操作 function get_url($n){ $con=mysql_connect("localhost","root","root"); mysql_select_db("0349org"); include_once 'config.php'; switch ($n) { case '1': break; case '2': $i=0; $arr=array(); $sql="select id from zl_product"; break; case '3': $i=0; $arr=array(); $sql="select id from zl_producttype"; break; case '4': $i=0; $arr=array(); $sql="select id from zl_arcticle"; break; case '5': $i=0; $arr=array(); $sql="select id from zl_area"; break; case '6': $i=0; $arr=array(); $sql_area="select id from zl_area"; $res_area=mysql_query($sql_area,$con); $sql_product="select id from zl_product"; $res_product=mysql_query($sql_product,$con); $arr_product=array(); while($arr_product[$i]=mysql_fetch_assoc($res_product)['id']){$i++;} array_pop($arr_product); $i=0; $arr_area=array(); while($arr_area[$i]=mysql_fetch_assoc($res_area)['id']){$i++;} array_pop($arr_area); $i=0; foreach ($arr_area as $key => $value) { foreach ($arr_product as $ke => $val) { $arr[$i]=$value.'/p'.$val;$i++; } } return $arr; break; case '7': $i=0; $arr=array(); $sql_area="select id from zl_area"; $res_area=mysql_query($sql_area,$con); $sql_product="select id from zl_product"; $res_product=mysql_query($sql_product,$con); $sql_producttype="select id from zl_producttype"; $res_producttype=mysql_query($sql_producttype); $i=0; $arr_area=array(); while($arr_area[$i]=mysql_fetch_assoc($res_area)['id']){$i++;} array_pop($arr_area); $i=0; $arr_producttype=array(); while ($arr_producttype[$i]=mysql_fetch_assoc($res_producttype)['id']){$i++;} array_pop($arr_producttype); $i=0; foreach ($arr_area as $key => $value) { foreach ($arr_producttype as $k => $v) { $arr[$i]=$value.'/p/'.$v.'.html';$i++; } } return $arr; break; case '8': $arr=array(); $arr[0]='http://www.0349.org.cn/about.html'; return $arr; break; case '9': $arr=array(); $arr[0]='http://www.0349.org.cn/contact.html'; return $arr; break; default: # code... break; } $res=mysql_query($sql,$con); while($arr[$i]=mysql_fetch_assoc($res)['id']){$i++;} array_pop($arr); return $arr; } $file='all.xml'; $h=create_xml($file); for ($n=1; $n <10 ; $n++) { $t=date('Y-m-d',time()); $c='weekly'; $url=''; if($n!=1){ $url=get_url($n);} wt($h,$url,$t,$c,$n); } ?>$v \r\n$time \r\n$cq \r\n$p \r\n