src/Leevel/View/Parser.php
protected function globalParse(string &$compiled): void
    {
        $tag = $this->getTag('global');

        if (preg_match_all(
            "/{$tag['left']}tagself{$tag['right']}(.+?){$tag['left']}\\/tagself{$tag['right']}/isx",
            $compiled, $res)) {
            $startPos = 0;

            foreach ($res[1] as $index => $encode) {
                $source = trim($res[0][$index]);
                $content = trim($res[1][$index]);

                $theme = [
                    'source'   => $source,
                    'content'  => $content,
                    'compiler' => 'global', // 编译器
                    'children' => [],
                ];

                $theme['position'] = $this->getPosition($compiled, $source, $startPos);
                $startPos = $theme['position']['end'] + 1;
                $theme = $this->normalizeThemeStruct($theme);

                // 将模板数据加入到树结构中
                $this->addTheme($theme);
            }
        }
    }
protected function globalParse(string &$compiled): void
    {
        $tag = $this->getTag('global');

        if (preg_match_all(
            "/{$tag['left']}tagself{$tag['right']}(.+?){$tag['left']}\\/tagself{$tag['right']}/isx",
            $compiled, $res)) {
            $startPos = 0;

            foreach ($res[1] as $index => $encode) {
                $source = trim($res[0][$index]);
                $content = trim($res[1][$index]);

                $theme = [
                    'source'   => $source,
                    'content'  => $content,
                    'compiler' => 'global', // 编译器
                    'children' => [],
                ];

                $theme['position'] = $this->getPosition($compiled, $source, $startPos);
                $startPos = $theme['position']['end'] + 1;
                $theme = $this->normalizeThemeStruct($theme);

                // 将模板数据加入到树结构中
                $this->addTheme($theme);
            }
        }
    }
全局编译器 tagself.

@param string $compiled