How to echo xml file in php

前端 未结 10 852
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 04:37

How to print an xml file to the screen in php?

This is not working:

$curl = curl_init();        
curl_setopt ($curl, CURLOPT_URL, \'http://rss.news.y         


        
10条回答
  •  自闭症患者
    2020-11-29 05:00

    The best solution is to add to your apache .htaccess file the following line after RewriteEngine On

    RewriteRule ^sitemap\.xml$ sitemap.php [L]
    

    and then simply having a file sitemap.php in your root folder that would be normally accessible via http://www.yoursite.com/sitemap.xml, the default URL where all search engines will firstly search.

    The file sitemap.php shall start with

    ';
    ?>
    
    
    
      https://www.yoursite.com/
      2020-01-08T13:06:14+00:00
      1.00
    
    
    
    
    

    it works :)

提交回复
热议问题