",'''',$vsstr);
/*过滤后缀 {/t:array} 取得中间文本.
可能出现,空格或者换行所以使用正则,也可直接使用strtr 替换 。
{/t:array }
{/t:array
}
strtr(strtolower($vsstr),array($skstr.''/''.$skdstr.$rarr[''tagname''].$sdstr=>''''));
*/
unset($va[0]);
$attr=array();
foreach($va as $val){//循环记录属性
$val=strtr($val,$glarr2); //typeid=''1'' 去掉 " '' / , typeid=1
$vc=explode(''='',$val);
if(!empty($vc[0])){
$vc[0]=strtolower($vc[0]); //小写属性名
if($vc[0]=="function"){
$rarr[''function'']=$vc; //返回要执行的 html2text(@me)
}else if($vc[0]=="name"){
$rarr[''tagfield'']=$vc; //{t:field name=''title'' /}
}else{
$attr[trim($vc[0])]=$vc; //属性 $attr[''typeid'']=1;
}
}
}
$rarr[''attr'']=$attr;
$CTags[$k]=$rarr;
}
echo "<pre>";
print_r($CTags);
echo "</pre>";
?>
输出内容:
复制代码 代码如下:
Array
(
[0] => Array
(
[str] => {t:arc row=''10''}
{t:field.title/}
{t:list row=''5''}
{t:field.title/}
{t:list row=''5''}
{t:field.title/}
{/t:list}{t:field.title/}
{/t:list}{t:field.title/}
{/t:arc}
[tagname] => arc
[tagfield] =>
[text] =>
{t:field.title/}
{t:list row=''5''}
{t:field.title/}
{t:list row=''5''}
{t:field.title/}
{/t:list}{t:field.title/}
{/t:list}{t:field.title/}
[attr] => Array
(
[row] => 10
)
)
=> Array
(
[str] => {T:channelartlist
row=''6''
}
{t:field name=''typename''/}{t:field.typename/}
{t:arclist titlelen=''42'' row=''10''}
[field:title/]
([field:sendtime function="MyDate(''m-d'',@me)"/])
{/t:arclist}
{/t:channelartlist
}
[tagname] => channelartlist
[tagfield] =>
[text] =>
{t:field name=''typename''/}{t:field.typename/}
{t:arclist titlelen=''42'' row=''10''}
[field:title/]
([field:sendtime function="MyDate(''m-d'',@me)"/])
{/t:arclist}
[attr] => Array
(
[row] => 6
)
)
=> Array
(
[str] => {t:global.cfg_title
/}
[tagname] => global
[tagfield] => cfg_title
[text] =>
[attr] => Array
(
)
)
=> Array
(
[str] => {t:var.cfg_title/}
[tagname] => var
[tagfield] => cfg_title
[text] =>
[attr] => Array
(
)
)
=> Array
(
[str] => {t:global.cfg_webname /}
[tagname] => global
[tagfield] => cfg_webname
[text] =>
[attr] => Array
(
)
)
=> Array
(
[str] => {t:global.cfg_title/}
[tagname] => global
[tagfield] => cfg_title
[text] =>
[attr] => Array
(
)
)
=> Array
(
[str] => {t:var.cfg_title/}
[tagname] => var
[tagfield] => cfg_title
[text] =>
[attr] => Array
(
)
)
=> Array
(
[str] => {t:field.title function="Html2Text(@me)"/}
[tagname] => field
[tagfield] => title
[text] =>
[function] => Html2Text(@me)
[attr] => Array
(
)
)
=> Array
(
[str] => {t:include
filename="header.htm"/}
[tagname] => include
[tagfield] =>
[text] =>
[attr] => Array
(
[filename] => header.htm
)
)
=> Array
(
[str] => {t:include filename="header.htm"
/}
[tagname] => include
[tagfield] =>
[text] =>
[attr] => Array
(
[filename] => header.htm
)
)
[10] => Array
(
[str] => {t:field.