我在html表中调用php函数时遇到了困难。
<table>
<thead class="table">
<tr><th>Letter</th><th>Sender</th></tr>
</thead>
<tbody>
<?php require_once 'assets/userFunctions.php';
foreach ($myCvs as $cv){
echo "<tr>
<td>{$cv['cv']}</td>
<td>getUsernameById({$cv['senderid']})</td>
</tr>";
}
?>
</tbody>
</table>
在表格中我只看到getUsernameById(2)
例如......
答案 0 :(得分:1)
你需要使用连接:
echo "<tr><td>" . $cv['cv'] . "</td><td>" . getUsernameById($cv['senderid']) . "</td></tr>";