Can PHP be used inside an XML file?

I am trying to create an RSS feed from a mysql database that I already have. Can I use PHP in an XML file that needs to be sent to the user so that it generates content on demand? Or should I use cron in a PHP file and generate an xml file? Or should I add the execution of the php file that xml generates after posting the content to be used in RSS? What do you think is best practice?

+3
source share
4 answers

All three approaches are technically possible. However, I would not use cron because it delays the process of updating your XML files after changing the contents of the database.

PHP- XML , , PHP , *.php, .htaccess.

, XML . , XML , , .

+2

cron PHP script, XML . PHP.

+2

, . , cron , , . .

+2

Content-type text/xml PHP , XML , . , , .

+2
source

Source: https://habr.com/ru/post/1777432/


All Articles