Heim  >  Artikel  >  Backend-Entwicklung  >  html公共模板,数组方式传值,数据调用方式?

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

WBOY
WBOYOriginal
2016-06-06 20:41:531153Durchsuche

有如下一段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>

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn