标签的替换
(\s表示任意的空白符,*表示前面的字符重复0次或多次);
用正则表达式替换模板中的{$xxx}
$pattern=array(
'#'.$this->left.'\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)'.$this->right.'#'
);
$replacement=array(
'<?php echo $this->value["$1"] ?>'
);
$this->content=preg_replace($pattern, $replacement, $this->content);