gpt4 book ai didi

PHP 包含在网页上放错位置/处理晚了吗?

转载 作者:行者123 更新时间:2023-11-28 01:26:23 25 4
gpt4 key购买 nike

我遇到了一个非常奇怪的问题,在我在页面上使用的三个 PHP 包含中,第一个是最后处理的,并且有些东西会破坏布局。 Chrome 完全忽略了 </div><!--col-md-4-->在第 21 行。

这是 main.php(为错乱的缩进道歉):

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pathfinder Character Generator</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<h1 class="text-center">Pathfinder Character Generator</h1>
<div class="container" style="border: 1px solid green">
<div class="row" style="border: 1px solid yellow">
<div class="col-md-4" style="border: 1px solid black;">

<!--Character Name-->
<label for="cg_name">Name</label>
<input type="text">

<!--Ability Scores-->
<?PHP include 'ability_scores.php';?>


</div><!--col-md-4-->

<div class="col-md-8" style="border: 1px solid red">

<?PHP include 'core_races.php';?>
<?PHP include 'core_classes.php';?>


<!--Level-->
<label for="cg_level">Level</label>
<input type="number" value="1" min="1" max="20">

<!--Feats & Spec. Abilities-->
<br>
<label for="FaSA">Feats &#38; Special Abilities</label>
<textarea id="FaSA" name="FaSA" cols="30" rows="10" placeholder=""></textarea>

<!--Submit -->
<button type="submit">Build</button>

</div><!--col-md-8-->
</div><!--row-->
</div><!--Container-->
</body>
</html>

这是我加载页面时 Chrome 开发者控制台的图像: http://i.imgur.com/RlDuAHt.png

</div><!--col-md-4-->第 21 行根本就没有了。不知道发生了什么事。我有预感这是我的主要问题,但在这一点上我不知所措。页面加载完毕,正如 Chrome 开发者控制台所示,“ability_scores.php”确实在其他两个 php 包含之后出现。也许我盯着这个看得太久了……

如有任何帮助,我们将不胜感激!

编辑:ability_scores.php

<?PHP
//--Ability Scores--
$core_abilities = array("STR","DEX","CON","INT","WIS","CHA");
echo "<table class='table-condensed'><tr><th>Skills</th><th></th></tr>";
foreach ($core_abilities as $abs){
echo "<tr><td>$abs</td><td><input type='number' value='0' min='-99' max='99'></td></tr>";
};
echo "<br>";
?>

我包含的另外两个 .php 文件非常相似:

核心类.php

<?PHP
//--Classes--
$core_classes = array("","barbarian","bard","cleric","druid","fighter","monk","paladin","ranger","rogue","sorcerer","wizard");
echo "<select>";
foreach ($core_classes as $class){
$class_name = ucfirst($class);
echo $class;
echo $class_name;
echo "<option value='$class'>$class_name</option>";
};
echo "</select><br>";
?>

core_races.php

<?PHP
//--Races--
$core_races = array("","dwarf","elf","gnome","half elf","half orc", "halfling","human");
echo "<select>";
foreach ($core_races as $races){
$race_name = ucfirst($races);
echo "<option value='$races'>$race_name</option>";
};
echo "</select><br>";

最佳答案

我找到了。我没有终止 <table>在 ability_scores.php 中。

关于PHP 包含在网页上放错位置/处理晚了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31950319/

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