-2
以下のPHPスクリプトで作業していますが、PHP変数を使用して高さと高さを設定したいと思います。私がそれを解決するのを助けるためのヒントと助けは大いに感謝しています。ありがとう。PHPの変数でhtmlテーブルの高さと幅を設定できません
<td height="<?= $table_height ?>px";...>
へ
<?php
$n = 5;
$table_height = 100;
?>
<!DOCTYPE html>
<html>
<head>
<title>Your Table is Ready</title>
</head>
<body>
<table>
<?php for ($i = 0; $i < $n; $i++): ?>
<tr>
<?php for ($x = 0; $x < $n; $x++): ?>
<td height="{$table_height}"; width = "{$n}"><?php print($i * $x) ?></td>
<?php endfor ?>
</tr>
<?php endfor ?>
</table>
</body>
</html>
あなたの変数は、PHPブロック内にはありません。別の場合は、スタイル属性を使用する方が 'height'や' width'よりも優れていますが、期待通りの効果は期待できません。 –