gpt4 book ai didi

php - 自动换行不让数字也换行

转载 作者:行者123 更新时间:2023-11-29 02:58:56 26 4
gpt4 key购买 nike

我有这种工作的形式唯一的事情是当用户在文本框数字中输入很多数字

例子:

12345678
3567892
1235674
36778883
566666678
35674748999
// with no spaces

它不想换行。我在网上找遍了它只显示了如何换行。

<html>
<?php

require_once("connect.php");
$stmt = $db->prepare("SELECT * FROM numbers");
$stmt->execute();

?>
<?php while( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) { ?>

<table border='1'table-layout: fixed >
<br>
<tr>
<th>Id</th>
<th>numbers</th>

</tr>
<tr>
<td style="word-wrap: break-word;"><?php echo $row['numbers']; ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>

最佳答案

尝试通过css指定表格的宽度。

<table border="1" style="table-layout: fixed; width: 150px;">
<tr>
<th>Id</th>
<th style="word-wrap: break-word;">numbers</th>

</tr>
<?php while( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) { ?>
<tr>
<td style="word-wrap: break-word;"><?php echo $row['id']; ?></td>
<td style="word-wrap: break-word;"><?php echo $row['numbers']; ?></td>
</tr>
<?php } ?>
</table>

关于php - 自动换行不让数字也换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26836287/

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