iis7_rewrite_rule_exists() - WordPress 函数参考中文文档

返回介绍

iis7_rewrite_rule_exists()

发布于 2017-09-11 字数1355 浏览 749 评论 0

iis7_rewrite_rule_exists( string $filename )

Check if rewrite rule for WordPress already exists in the IIS 7+ configuration file


描述


参数

$filename

(string)
(Required)
The file path to the configuration file


返回值

(bool)


源代码

File: wp-admin/includes/misc.php

function iis7_rewrite_rule_exists($filename) {
	if ( ! file_exists($filename) )
		return false;
	if ( ! class_exists( 'DOMDocument', false ) ) {
		return false;
	}

	$doc = new DOMDocument();
	if ( $doc->load($filename) === false )
		return false;
	$xpath = new DOMXPath($doc);
	$rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]');
	if ( $rules->length == 0 )
		return false;
	else
		return true;
}

更新日志

Version 描述
2.8.0 Introduced.

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!