我写下我的php代码:
<?php
// 已有指定 material, 顯示 material 資訊
if (strlen($m_id) > 0) {
// 此 material 屬於哪些 mgroup
$group_info = $mUtil->groupInfo($m_id);
$group_names = array();
foreach ($group_info as $mg_id => $row) {
if (!$row["not_in_group"]) {
$group_names[] = $row["mg_name"];
}
}
}
?>
<table width="100%">
<tr>
<th colspan="2"><?php echo $m_name; ?></th>
</tr>
<tr class="odd">
<th>Formula</th>
<td width="80%"><?php echo $formula; ?></td>
</tr>
<tr class="odd">
<th>Alias</th>
<td><?php echo $alias; ?></td>
</tr>
<tr class="odd">
<th>In groups</th>
<!-- join() == implode() -->
<td><?php echo join($group_names, ", "); ?></td>
</tr>
</table><br /><br />
但我收到这些错误消息:
Notice: Undefined variable: group_names in eval() (line 97 of D:\xampp\htdocs\drupal\modules\php\php.module(80) : eval()'d code).
Warning: join() [function.join]: Invalid arguments passed in eval() (line 97 of D:\xampp\htdocs\drupal\modules\php\php.module(80) : eval()'d code).
Notice: Undefined variable: group_names in eval() (line 97 of D:\xampp\htdocs\drupal\modules\php\php.module(80) : eval()'d code).
Warning: join() [function.join]: Invalid arguments passed in eval() (line 97 of D:\xampp\htdocs\drupal\modules\php\php.module(80) : eval()'d code).
任何人都可以帮助我吗?非常感谢....