gpt4 book ai didi

php - 如果你需要 3 个 'tiers' 的引号,你会怎么做?

转载 作者:行者123 更新时间:2023-11-28 17:54:41 25 4
gpt4 key购买 nike

例如,我知道您可以从 "转到 ',但是还有第三个吗?

我正在制作一个 $form 变量,我需要 3 个级别的引号

    $form = "<table id ='create_school_table'>
<tr>
<td>school name:</td>
<td><input type = 'text' maxlength='50' name='school_name' style='width: 174px;'/></td>
</tr>
<tr>
<td>state:</td>
<td><select name='state'>
<?php foreach ($states as $state) : ?>
//THIS NEXT LINE IS TRIPPING ME UP
<option value='<?php echo $state['state_name']; ?>'>
<?php echo $state['state_name']; ?>
</option>
<?php endforeach; ?>
</select></td>
</tr>
<tr>
<td></td>
<td><input type='button' value='add school' name='submitbtn' onclick='execute_add_school()' /></td>
</tr>
</table>"

最佳答案

你能使用更多的变量吗?

$form = "Your initial HTML";

$states = "";
foreach ($states as $state) {
$states .= "<option value='" . $state['state_name'] . "'>"
. $state['state_name'] . "</option>";
}

$form .= $states;
$form .= "the rest of your HTML";

如果您明确尝试将其全部保存在一个变量中,请随时更新您的问题以反射(reflect)这一点。

关于php - 如果你需要 3 个 'tiers' 的引号,你会怎么做?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21541666/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com