got_mod_rewrite

函式
got_mod_rewrite ( No parameters )
返回值
  • (bool) Whether the server is running Apache with the mod_rewrite module loaded.
定義位置
相關方法
got_url_rewritesave_mod_rewrite_rulesremove_rewrite_tagget_num_queriesadd_rewrite_tag
引入
2.0.0
棄用
-

got_mod_rewrite: 這個函式用來檢查伺服器上是否有mod_rewrite。如果mod_rewrite可用,該函式返回一個布林值為true,否則為false。

返回伺服器是否正在執行載入了mod_rewrite模組的Apache。

function got_mod_rewrite() {
	$got_rewrite = apache_mod_loaded( 'mod_rewrite', true );

	/**
	 * Filters whether Apache and mod_rewrite are present.
	 *
	 * This filter was previously used to force URL rewriting for other servers,
	 * like nginx. Use the {@see 'got_url_rewrite'} filter in got_url_rewrite() instead.
	 *
	 * @since 2.5.0
	 *
	 * @see got_url_rewrite()
	 *
	 * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
	 */
	return apply_filters( 'got_rewrite', $got_rewrite );
}

常見問題

FAQs
檢視更多 >