返回介绍

iis7_save_url_rewrite_rules()

发布于 2017-09-11 00:57:24 字数 2263 浏览 997 评论 0 收藏 0

iis7_save_url_rewrite_rules()

Updates the IIS web.config file with the current rules if it is writable.


description

If the permalinks do not require rewrite rules then the rules are deleted from the web.config file.


返回值

(bool) True if web.config was updated successfully


源代码

File: wp-admin/includes/misc.php

function iis7_save_url_rewrite_rules(){
	if ( is_multisite() )
		return;

	global $wp_rewrite;

	$home_path = get_home_path();
	$web_config_file = $home_path . 'web.config';

	// Using win_is_writable() instead of is_writable() because of a bug in Windows PHP
	if ( iis7_supports_permalinks() && ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) ) {
		$rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', '');
		if ( ! empty($rule) ) {
			return iis7_add_rewrite_rule($web_config_file, $rule);
		} else {
			return iis7_delete_rewrite_rule($web_config_file);
		}
	}
	return false;
}

更新日志

Versiondescription
2.8.0Introduced.

相关函数

Uses

  • wp-admin/includes/misc.php: iis7_add_rewrite_rule()
  • wp-admin/includes/misc.php: iis7_delete_rewrite_rule()
  • wp-admin/includes/file.php: get_home_path()
  • wp-includes/load.php: is_multisite()
  • wp-includes/functions.php: iis7_supports_permalinks()
  • wp-includes/functions.php: win_is_writable()
  • wp-includes/class-wp-rewrite.php: WP_Rewrite::iis7_url_rewrite_rules()
  • wp-includes/class-wp-rewrite.php: WP_Rewrite::using_mod_rewrite_permalinks()
  • Show 3 more uses Hide more uses

Used By

  • wp-includes/class-wp-rewrite.php: WP_Rewrite::flush_rules()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文