【问题标题】:How can I host PHP files on Apache without executing?如何在不执行的情况下在 Apache 上托管 PHP 文件?
【发布时间】:2023-04-10 06:31:01
【问题描述】:

如果我在 Apache 上托管一个 PHP 文件,它将被执行。我希望客户端能够在不更改 .php 扩展名的情况下下载 PHP 文件。我也不想禁用 PHP。

【问题讨论】:

标签: php apache http


【解决方案1】:

如果您不想使用 apache 配置或 .htaccess,请使用 PHP 本身来完成它

使用以下代码创建文件showcode.php

echo file_get_contents('/path/to/your/php/file/having/viewable/code/for/users/');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-11
    • 2011-04-25
    • 1970-01-01
    相关资源
    最近更新 更多