"Smarty foreach"콤포션을 재현하고 싶습니다.Php preg_match_all로 Smarty foreach 재현
{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
(
)
)
내가 코드를 반환 할 수있는 방법
TPL 파일 내용은 ($ tplContent)입니다 {foreach} {/ foreach} 사이에요?
이 패턴이 작동하지 않습니다. ( –
죄송합니다, 구문이 좋지 않아서 테스트를 마친 후 잠시 후 편집하겠습니다. –
죄송합니다, 괜찮습니다.하지만 진짜라고 생각합니다. probes를 만든 콘텐츠를 사용합니다. 흠. 나는 나의 질문을 새롭게한다. –