2010
V2EX  ›  PHP

PHP 中 AddType application/x-httpd- PHP

  •  
  •   2010 · May 12, 2019 · 3223 views
    This topic created in 2561 days ago, the information mentioned may be changed or developed.

    问题描述

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

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3114 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:16 · PVG 21:16 · LAX 06:16 · JFK 09:16
    ♥ Do have faith in what you're doing.