简要咨询咨询QQ网站导航网站搜索手机站点联系我们设为首页加入收藏 

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

来源:易贤网   阅读:1325 次  日期: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技术专栏

更多信息请查看网络编程
点此处就本文及相关问题在本站进行非正式的简要咨询(便捷快速)】     【点此处查询各地各类考试咨询QQ号码及交流群
上一篇:php利用反射实现插件机制的方法
下一篇:php从数组中随机选择若干不重复元素的方法
易贤网手机网站地址:php检测apache mod_rewrite模块是否安装的方法
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!