I'd like to change one text file on my server to be parsed by PHP -开发者_JAVA百科 how do I do this?
I assume you already have the appropriate lines in Apache to enable PHP in general. To use PHP to parse a non .php ending file, you can use a ForceType directive in either an htaccess file or in the apache config. For example:
<Files ~ '^(file1.txt|anotherfile.txt)$'>
ForceType application/x-httpd-php
</Files>
That expression is flexible and you can add additional files to match within the parentheses using another pipe character.
精彩评论