Heim > Artikel > Backend-Entwicklung > 请教如何把一个PHP数组放到这个JS里面啊
请问怎么把一个PHP数组放到这个JS里面啊?
........................................
foreach($category as $group) {
$groupselect.= "\n";
}
echo
<script><br />
var rowtypedata = [<br />
[<br />
[1,'', 'td25'],<br />
[1,'<input type="text" class="txt" size="12" name="groupnamenewadd[]">', ''],<br />
[1,'<select name="groupnamenewadd[]"><option value="<span style="color: #FF00FF;">$groupselect"><span style="color: #FF00FF;">$groupselect', ''],<br />
<br />
[1,'<input type="text" class="txt" size="12" name="groupurlnewadd[]">', '']<br />
]<br />
];<br />
</script>
EOT;
试了好多种写法。都不行。只好上来求助了。$groupselect怎么才能写到JS里面呢?
<br /> <script type="text/JavaScript"><br /> var rowtypedata = [<br /> [<br /> [1,'', 'td25'],<br /> [1,'<input type="text" class="txt" size="12" name="groupnamenewadd[]">', ''],<br /> [1,'<select name="groupnamenewadd[]"><?php $groupselect ?></select>', ''],<br /> <br /> [1,'<input type="text" class="txt" size="12" name="groupurlnewadd[]">', '']<br /> ]<br /> ];<br /> </script><br />