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

返回介绍

extract_from_markers()

发布于 2017-09-10 字数1427 浏览 896 评论 0

extract_from_markers( string $filename,  string $marker )

Extracts strings from between the BEGIN and END markers in the .htaccess file.


描述


参数

$filename

(string)
(Required)

$marker

(string)
(Required)


返回值

(array) An array of strings from a file (.htaccess ) from between BEGIN and END markers.


源代码

File: wp-admin/includes/misc.php

function extract_from_markers( $filename, $marker ) {
	$result = array ();

	if (!file_exists( $filename ) ) {
		return $result;
	}

	if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
	{
		$state = false;
		foreach ( $markerdata as $markerline ) {
			if (strpos($markerline, '# END ' . $marker) !== false)
				$state = false;
			if ( $state )
				$result[] = $markerline;
			if (strpos($markerline, '# BEGIN ' . $marker) !== false)
				$state = true;
		}
	}

	return $result;
}

更新日志

Version 描述
1.5.0 Introduced.

User Contributed Notes

上一篇:export_wp()

下一篇:favorite_actions()

发布评论

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

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