php檢測apache mod_rewrite模塊是否安裝的方法
更新時間:2015年03月14日 10:23:03 作者:work24
這篇文章主要介紹了php檢測apache mod_rewrite模塊是否安裝的方法,通過對apache mod_rewrite模塊相關(guān)函數(shù)的檢測實現(xiàn)該檢測功能,需要的朋友可以參考下
本文實例講述了php檢測apache mod_rewrite模塊是否安裝的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
/** * @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程序設(shè)計有所幫助。
相關(guān)文章
PHP面向?qū)ο髮W習之parent::關(guān)鍵字
在PHP中不能定義重名的函數(shù),也包括不能再同一個類中定義重名的方法,所以也就沒有方法重載。下面這篇文章主要給大家介紹了PHP面向?qū)ο笾畃arent::關(guān)鍵字的相關(guān)資料,需要的朋友可以參考借鑒,下面來一起看看吧。2017-01-01PHP數(shù)組操作——獲取數(shù)組最后一個值的方法
這篇文章主要介紹了PHP數(shù)組操作——獲取數(shù)組最后一個值的方法,需要的朋友可以參考下2015-04-04php創(chuàng)建和刪除目錄函數(shù)介紹和遞歸刪除目錄函數(shù)分享
這篇文章主要介紹了php創(chuàng)建和刪除目錄函數(shù)介紹和遞歸刪除目錄函數(shù)分享,本文重點是對遞歸刪除目錄的自定義函數(shù)分享,需要的朋友可以參考下2014-11-11