V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
2010
V2EX  ›  PHP

PHP 中 AddType application/x-httpd- PHP

  •  
  •   2010 · 2019-05-12 19:18:42 +08:00 · 2826 次点击
    这是一个创建于 1811 天前的主题,其中的信息可能已经有所发展或是发生改变。

    问题描述

    在看 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

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2897 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 14:35 · PVG 22:35 · LAX 07:35 · JFK 10:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.