Think/Template.php
protected function parsePhp($content)
    {
        if (ini_get('short_open_tag')) {
            // 开启短标签的情况要将<?标签用echo方式输出 否则无法正常输出xml标识
            $content = preg_replace('/(<\?(?!php|=|$))/i', '<?php echo \'\\1\'; ?>'."\n", $content);
        }
        // PHP标签检查
        if (C('TMPL_DENY_PHP') && false !== strpos($content, '<?php')) {
            throw new BaseException(L('_NOT_ALLOW_PHP_'));
        }

        return $content;
    }
protected function parsePhp($content)
    {
        if (ini_get('short_open_tag')) {
            // 开启短标签的情况要将<?标签用echo方式输出 否则无法正常输出xml标识
            $content = preg_replace('/(<\?(?!php|=|$))/i', '<?php echo \'\\1\'; ?>'."\n", $content);
        }
        // PHP标签检查
        if (C('TMPL_DENY_PHP') && false !== strpos($content, '<?php')) {
            throw new BaseException(L('_NOT_ALLOW_PHP_'));
        }

        return $content;
    }
解析PHP标签

@param $content
@return mixed
@throws BaseException