【发布时间】:2009-04-02 18:54:07
【问题描述】:
我想重现“Smarty foreach”的说法。
tpl 文件内容为 ($tplContent) :
{foreach from=$tabMethodTest item=entry}
/**
* @todo Implement test{$entry.name}().
*/
public function test{$entry.name}() {
$this->markTestIncomplete("This test has not been implemented yet.");
}
{/foreach}
preg_match_all 代码是:
preg_match_all("/(.*)\{foreach(.*)\}(.*)\{\/foreach\}(.*)/im",$tplContent,$regsTplResult);
print_r($regsTplResult);
print_r 返回:
Array
(
[0] => Array
(
)
[1] => Array
(
)
[2] => Array
(
)
[3] => Array
(
)
[4] => Array
(
)
)
如何在 {foreach}{/foreach} 之间返回代码?
【问题讨论】:
标签: php foreach smarty preg-match-all