コールバックのコンテンツタグを正規表現で置き換えます
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-07-25 09:09:35
- function my_wp_plugin_tag_action($content,$tag,$function,$args = FALSE) {
- // すべての正規表現に一致
- preg_match_all($tag,$content,$matches);
- if (count($matches) >0) {
- // 重複をフィルター
- $matches = array_unique($matches);
- // ループスルー
- $tag_results = array();
- $found_tags = array();
- foreach ($matches as $idx = > $match) {
- //引数配列を構築します
- $full_tag = array_shift($match);
- //関数の出力と完全なタグテキストを置換配列に追加します
- $tag_results[] = my_wp_plugin_buffer_func($function,$ match);
- $found_tags[] = $full_tag;
- }
- // すべてのタグを対応するテキストに置き換えます
- $content = str_replace($found_tags,$tag_results,$content);
- }
- return $content;
- }
复制幣
|
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
著者別の最新記事
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11