Think/Template.php
private function parseXmlAttrs($attr)
    {
        $xml = '<tpl><tag '.$attr.' /></tpl>';
        /**
         * @var $xml \SimpleXMLElement
         */
        $xml = \simplexml_load_string($xml);
        if (!$xml) {
            throw new BaseException(L('_XML_TAG_ERROR_'));
        }
        $xml = (array)($xml->tag->attributes());

        return array_change_key_case($xml['@attributes']);

    }
private function parseXmlAttrs($attr)
    {
        $xml = '<tpl><tag '.$attr.' /></tpl>';
        /**
         * @var $xml \SimpleXMLElement
         */
        $xml = \simplexml_load_string($xml);
        if (!$xml) {
            throw new BaseException(L('_XML_TAG_ERROR_'));
        }
        $xml = (array)($xml->tag->attributes());

        return array_change_key_case($xml['@attributes']);

    }
分析XML属性


@param string $attr XML属性字符串
@return array
@throws BaseException