php - 如何在 Apache 中将 php 文件显示为纯文本

标签 php apache

对于我本地 Apache 服务器(与 Ubuntu 一起运行)上的某个文件夹,我希望所有 *php 文件都显示为纯文本文件。我需要这个,因为我只想查看这些文件的源代码而不是运行它们。

在搜索时,我发现大多数人都有相反的问题 :-) 并且找不到真正适合我的解决方案。

我需要在文件夹的 .htacces-file 中包含什么?

谢谢!

最佳答案

答案:

在 .htaccess 文件类型中

php_flag engine off 
#This will prevent apache from executing *.php-files

AddType text/plain php
#this wil display php-files in browser (if not, browser will want to download file!)

感谢布拉德!

关于php - 如何在 Apache 中将 php 文件显示为纯文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4236951/

相关文章:

php - Symfony2主义关系数据

php glob() 如果在 Windows 上为空则返回数组,在 Linux 上则没有

apache - 升级 Apache 2.2 -> 2.4

php - pecl install intl 没有可用的版本?

php - 如何用表单数据更新数据库

php - 嵌套集模型 : Query node childs only 1 level below AND all parents above

php - 我的 PDO 插入没有错误......但它没有插入我的数据库

php - MySQL 查询(28K 行)使服务器过载

phpMyAdmin 对于 php 5.5.8 出现错误 404

apache - 这些重写规则的 IIS 等价物是什么?