php检测apache mod_rewrite模块是否安装的方法
来源:易贤网 阅读:1416 次 日期:2015-03-19 14:11:14
温馨提示:易贤网小编为您整理了“php检测apache mod_rewrite模块是否安装的方法”,方便广大网友查阅!

本文实例讲述了php检测apache mod_rewrite模块是否安装的方法。分享给大家供大家参考。具体实现方法如下:

/**

* @title Check if Apache's mod_rewrite is installed.

*

* @author Pierre-Henry Soria <>

* @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程序设计有所帮助。

更多信息请查看IT技术专栏

更多信息请查看网络编程
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 新媒体/短视频平台 | 手机站点

版权所有:易贤网