可以同时生成首页、文章、单页面、分类和标签的 sitemap!一、PHP 代码<?php require('./wp-blog-header.php'); header("Content-type: text/xml"); header('HTTP/1.1 200 OK'); $posts_to_show = 1000; echo '<?xml version="1.0" encoding="UTF-8"?>'; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="http:/
在使用mb_convert_encoding时要先知道字符编码,如果编码错误就会乱码,使用mb_detect_encoding自动识别字符串编码,并转换成国际标准编码utf-8编码。<?php $encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5','LATIN1'));