changing extension of a file

Discussion in 'PHP' started by sprabhu, Oct 6, 2009.

  1. #1
    How to change extension of a file php file from
    file.php to file.xml
     
    sprabhu, Oct 6, 2009 IP
  2. Sergey Popov

    Sergey Popov Peon

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you want client browser to recognize your file.php as an XML, you need to set content-type header before outputting xml code, like this:

    file.php
    <?php
      header ("Content-Type:text/xml");
    
      // ..... your code here ...
    
    ?>
    
    PHP:
     
    Sergey Popov, Oct 6, 2009 IP
  3. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0