加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

AddHandler不适用于.php文件 – Apache 2.4

发布时间:2020-12-13 13:25:11 所属栏目:PHP教程 来源:网络整理
导读:我正在为.php和.html文件创建一个名为helloworld的虚拟处理程序.处理程序包含: static int helloworld_handler(request_rec *r){ ap_rprintf(r,"hello world!"); return OK;} 我在apache2.conf中得到了这个: Directory /var/www/htmlAddHandler helloworld
我正在为.php和.html文件创建一个名为helloworld的虚拟处理程序.处理程序包含:
static int helloworld_handler(request_rec *r){
    ap_rprintf(r,"hello world!");
    return OK;
}

我在apache2.conf中得到了这个:

<Directory /var/www/html>
AddHandler helloworld .php .html
</Directory>

处理程序“helloworld”适用于.html文件,但它不适用于.php文件.我认为这主要是因为默认的PHP处理程序会覆盖.php文件的helloworld处理程序.如何使“helloworld”处理程序适用于.php文件?

如果需要任何额外信息,请询问.

您可能想要尝试 SetHandler
<FilesMatch .php$>
    SetHandler helloworld
</FilesMatch>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读