本文整理匯總了PHP中Spotter::getAllDates方法的典型用法代碼示例。如果您正苦於以下問題:PHP Spotter::getAllDates方法的具體用法?PHP Spotter::getAllDates怎麽用?PHP Spotter::getAllDates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Spotter
的用法示例。
在下文中一共展示了Spotter::getAllDates方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
$output .= '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
$ident_names = Spotter::getAllIdents();
foreach ($ident_names as $ident_item) {
$output .= '<url>';
$output .= '<loc>' . $globalURL . '/ident/' . $ident_item['ident'] . '</loc>';
$output .= '<lastmod>' . date("c", time()) . '</lastmod>';
$output .= '<changefreq>daily</changefreq>';
$output .= '</url>';
}
$output .= '</urlset>';
} else {
if ($_GET['type'] == "date") {
$output .= '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
$date_names = Spotter::getAllDates();
foreach ($date_names as $date_item) {
$output .= '<url>';
$output .= '<loc>' . $globalURL . '/date/' . date("Y-m-d", strtotime($date_item['date'])) . '</loc>';
$output .= '<lastmod>' . date("c", time()) . '</lastmod>';
$output .= '<changefreq>daily</changefreq>';
$output .= '</url>';
}
$output .= '</urlset>';
} else {
if ($_GET['type'] == "route") {
$output .= '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
$route_names = Spotter::getAllRoutes();
foreach ($route_names as $route_item) {
$output .= '<url>';
示例2: foreach
$ident_names = $Spotter->getAllIdents();
foreach ($ident_names as $ident_item) {
if (ctype_alnum($ident_item['ident'])) {
$output .= '<url>';
$output .= '<loc>' . 'http://' . $_SERVER['HTTP_HOST'] . $globalURL . '/ident/' . $ident_item['ident'] . '</loc>';
$output .= '<lastmod>' . date("c", time()) . '</lastmod>';
$output .= '<changefreq>daily</changefreq>';
$output .= '</url>';
}
}
$output .= '</urlset>';
} else {
if (isset($_GET['type']) && $_GET['type'] == "date") {
$output .= '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
$date_names = $Spotter->getAllDates();
foreach ($date_names as $date_item) {
$output .= '<url>';
$output .= '<loc>' . 'http://' . $_SERVER['HTTP_HOST'] . $globalURL . '/date/' . date("Y-m-d", strtotime($date_item['date'])) . '</loc>';
$output .= '<lastmod>' . date("c", time()) . '</lastmod>';
$output .= '<changefreq>daily</changefreq>';
$output .= '</url>';
}
$output .= '</urlset>';
} else {
if (isset($_GET['type']) && $_GET['type'] == "route") {
$output .= '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
$route_names = $Spotter->getAllRoutes();
foreach ($route_names as $route_item) {
$output .= '<url>';