如何在 PHP 中使用 echo 在同一行內同時建立粗體和普通文字?


要獲取粗體文字,你需要使用 font-weight,要獲取普通文字,你可以使用 <span> 標籤。所有這些都會新增到 echo 中。

示例

PHP 程式碼如下

 即時演示

<!DOCTYPE html>
<html>
<body>
<?php
echo '<span style="font-size: 20px; color: #006400; font-weight: bold;">This is my first PHP Program</span> '.$row['data'];
?>
</body>
</html>

輸出

以下是示例輸出的快照。

This is my first PHP Program

更新日期:13-Oct-2020

2K+ 瀏覽量

開啟你的 職業生涯

完成課程並獲得認證

開始
廣告