记录一下使用php代码检测当前web环境是否支持rewrite,支持IIS,APACHE,NGINX
function mod_rewrite(){ /** * -------------------------------------------------------------- * MOD REWRITE CHECK * -------------------------------------------------------------- * Define Constant for MOD REWRITE * * Check if server allows MOD REWRITE. Checks for both * Apache and IIS. * */ if( function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules()) ) return TRUE; elseif( isset($_SERVER['IIS_UrlRewriteModule']) ) return TRUE; else return FALSE; } mod_rewrite();