<?xml version="1.0" encoding="UTF-8"?>
<!-- created with www.mysitemapgenerator.com -->
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://pres.ru.com/</loc>
<lastmod>2018-09-15T10:42:15+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://pres.ru.com/?id=1</loc>
<lastmod>2018-09-15T10:42:16+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://pres.ru.com/?id=2</loc>
<lastmod>2018-09-15T10:42:16+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://pres.ru.com/article/short/7</loc>
<lastmod>2018-09-15T10:42:26+01:00</lastmod>
<priority>0.6</priority>
</url>
</urlset>$siteMap["url"][3]//Формируем базовую часть ссылки
$baseLink = "https://pres.ru.com/article/short/";
$id = 7;
$linkNews = $baseLink.$id;
//Путь к карте сайта
$pathSiteMap = Yii::getAlias("@app")."\sitemap.xml";
//Открываем файл карты в режиме редактирования
$siteMap = simplexml_load_file($pathSiteMap);
print_r($siteMap);SimpleXMLElement Object
(
[url] => Array
(
[0] => SimpleXMLElement Object
(
[loc] => https://pres.ru.com/
[lastmod] => 2018-09-15T10:42:15+01:00
[priority] => 1.0
)
[1] => SimpleXMLElement Object
(
[loc] => https://pres.ru.com/?id=1
[lastmod] => 2018-09-15T10:42:16+01:00
[priority] => 1.0
)
[2] => SimpleXMLElement Object
(
[loc] => https://pres.ru.com/?id=2
[lastmod] => 2018-09-15T10:42:16+01:00
[priority] => 1.0
)
[3] => SimpleXMLElement Object
(
[loc] => https://pres.ru.com/article/short/7
[lastmod] => 2018-09-15T10:42:26+01:00
[priority] => 0.6
)
}
$siteMap = simplexml_load_file($pathSiteMap);
$siteMap->url[3]