>  기사  >  백엔드 개발  >  html公共模板,数组方式传值,数据调用方式?

html公共模板,数组方式传值,数据调用方式?

WBOY
WBOY원래의
2016-06-06 20:41:531153검색

有如下一段html放在公共模板中

<code><input type="text" name="$text_name" value="$data[$test_name]">
</code>

然后在通过如下方式调用复用

<code><include file="xxx.html $text_name=" info1></include>
<include file="xxx.html $text_name=" info2></include>
</code>

这样子在提交表单数据跟回显的时候是可以正常调用的
但是,我想要用数组方式传递数据,用如下方式调用

<code><include file="xxx.html $text_name=" info></include>
<include file="xxx.html $text_name=" info></include>
</code>

这样子在数据回显的时候就不懂得该怎么处理数据访问方式
想看看大家是怎么处理的[或者是其他更好的模板分离方式],谢谢

回复内容:

有如下一段html放在公共模板中

<code><input type="text" name="$text_name" value="$data[$test_name]">
</code>

然后在通过如下方式调用复用

<code><include file="xxx.html $text_name=" info1></include>
<include file="xxx.html $text_name=" info2></include>
</code>

这样子在提交表单数据跟回显的时候是可以正常调用的
但是,我想要用数组方式传递数据,用如下方式调用

<code><include file="xxx.html $text_name=" info></include>
<include file="xxx.html $text_name=" info></include>
</code>

这样子在数据回显的时候就不懂得该怎么处理数据访问方式
想看看大家是怎么处理的[或者是其他更好的模板分离方式],谢谢

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.