从我到处查看并研究它似乎也可以将标签放在你的PHP代码中,但出于某种原因,只有当我的标签在php之外它才有效。我似乎无法弄清楚它的问题。我试图在里面打印的原因是因为我试图创建一个嵌套的for循环。目前我注释掉了php之外的表标签,并将它们打印在php代码中。这目前不起作用。这是我的代码,再次感谢你。
<?php print( '<?xml version = "1.0" encoding = "utf-8"?>') ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>User selection page</title>
</head>
<!-- <table border="1px"> -->
<!-- <tbody> -->
<?php
/*
Version 1.1: Instead of printing the teams in different cells we are going to print the
games in one row and we select the game itself to see if an upset will occur.
*/
require_once('Conference.php');
$loadGameClass = new Conference();
$loadGameClass->loadTeams(array("(1)Gonzaga vs (16)Southern U", "(8)Pittsburgh vs (9)Wichita St", "(5)Wisconsin vs (12)Ole Miss", "(4)Kansas st vs (13)Boise St", "(6)Arizona vs (11)Belmont", "(3)New Mexico vs (14) Harvard", "(7)Notre Dame vs (10)Iowa St", "(2)Ohio St vs (15) Iona"));
$teams = $loadGameClass->getTeams();
echo "<table border="1">";
for ($i = 0; $i < 8; $i++)
{
$highSeed = $teams[$i];
//$lowSeed = $teams[((2*8)-1)-$i];
echo "<tr><td>$highSeed</td>"; //<td>$lowSeed</td></tr>
}
echo "</table>";
?>
<!-- </tbody> -->
<!-- </table> -->
<body>
</body>
</html>
答案 0 :(得分:1)
第一个问题是
echo "<table border="1">";
应该是
echo '<table border="1">';
然后
echo "<tr><td>$highSeed</td>";
更好的方法是
echo '<tr><td>'.$highSeed.'</td></tr>';