加入收藏 | 设为首页 | 会员中心 | 我要投稿 鹤壁站长网 (https://www.0392zz.cn/)- 分布式云、存储数据、视频终端、媒体处理、内容创作!
当前位置: 首页 > 运营中心 > 建站资源 > 经验 > 正文

php检测apache mod_rewrite模块是否安装的方法

发布时间:2021-12-21 17:03:43 所属栏目:经验 来源:互联网
导读:这篇文章主要介绍了php检测apache mod_rewrite模块是否安装的方法,通过对apache mod_rewrite模块相关函数的检测实现该检测功能,需要的朋友可以参考下 本文实例讲述了php检测apache mod_rewrite模块是否安装的方法,分享给大家供大家参考,具体实现方法如下:
这篇文章主要介绍了php检测apache mod_rewrite模块是否安装的方法,通过对apache mod_rewrite模块相关函数的检测实现该检测功能,需要的朋友可以参考下
 
本文实例讲述了php检测apache mod_rewrite模块是否安装的方法,分享给大家供大家参考,具体实现方法如下:
 
/**
 * @title Check if Apache's mod_rewrite is installed.
 *  
 * @author Pierre-Henry Soria <ph7software@gmail.com>
 * @copyright (c) 2013, Pierre-Henry Soria. All Rights Reserved.
 * @return boolean
 */
function isRewriteMod()
{
  if (function_exists('apache_get_modules'))
  {
    $aMods = apache_get_modules();
    $bIsRewrite = in_array('mod_rewrite', $aMods);
  }
  else
  {
    $bIsRewrite = (strtolower(getenv('HTTP_MOD_REWRITE')) == 'on');
  }
  return $bIsRewrite;
}
使用方法:
 
if (!isRewriteMod()) exit('Please install Apache mod_rewrite module.');
 
希望本文所述对大家的php程序设计有所帮助。

(编辑:鹤壁站长网)

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

    推荐文章
      热点阅读