PHP 中 AddType application/x-httpd- PHP

2019-05-12 19:18:42 +08:00
 2010

问题描述

在看 https://www.php.net/manual/zh/security.php 其中 https://www.php.net/manual/zh/security.hiding.php 好奇便想着试试

# 使 PHP 代码看上去像 HTML 页面
    AddType application/x-httpd-php .htm .html

我尝试过通过 .htaccess 和 Apache 的配置文件修改,结果都会出现 htm 文件会被直接下载

问题出现的环境背景及自己尝试过哪些方法

<?php
    header('Content-Type: text/html');
    echo 'hello';

也会被直接下载

当把环境恢复正常时新建 x.php

<?php echo $_SERVER['REDIRECT_HANDLER']; ?>

输出为空白

<?php var_dump($_SERVER['REDIRECT_HANDLER']); ?>

输出为 null

2831 次点击
所在节点    PHP
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/563401

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX