修复标签属性不支持-的问题

This commit is contained in:
oldrind
2016-02-29 09:43:33 +08:00
parent 755a3d22b5
commit 884e036a46
2 changed files with 2 additions and 2 deletions

View File

@@ -645,7 +645,7 @@ class Template
*/
public function parseAttr($str, $name = null)
{
$regex = '/\s+(?>(?<name>\w+)\s*)=(?>\s*)([\"\'])(?<value>(?:(?!\\2).)*)\\2/is';
$regex = '/\s+(?>(?<name>[\w-]+)\s*)=(?>\s*)([\"\'])(?<value>(?:(?!\\2).)*)\\2/is';
$array = [];
if (preg_match_all($regex, $str, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {