在里面调用php函数

时间:2016-12-30 20:47:19

标签: php html

我在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)例如......

1 个答案:

答案 0 :(得分:1)

你需要使用连接:

echo "<tr><td>" . $cv['cv'] . "</td><td>" . getUsernameById($cv['senderid']) . "</td></tr>";