PHP code inside XML?

前端 未结 7 2130
名媛妹妹
名媛妹妹 2021-01-06 13:56

is it possible to put PHP code inside a XML document to be later executed? For example, can I say \" />

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-06 14:16

    A PHP program can output any kind of content you like, however it will (if used with a web module like mod_php) output with a text/html content type by default, so you will need to do:

    
    

    (Substitute a more appropriate content-type if one is applicable).

    You will also need to configure your webserver to recognise that the file should be treated as PHP and not served up as static data. This is usually achieved by giving the file a .php extension. Consult the manual for your webserver and PHP's module for it if you want to use a different file naming convention.

提交回复
热议问题