如何使用PHP在数组中加粗HTML文本?

时间:2014-10-02 22:00:37

标签: php html

我有一小段代码

<?php 
     foreach ($options['attributes_info'] as $attribute) : 
?>
<?php 
         echo '<br/>&nbsp;&nbsp;' .
              $this->getPdfHelper()->fixEncoding(
                  $attribute['label'] . ': ' . $attribute['value']
              ) 
?>  
<?php 
     endforeach; 
?> 

如何加粗(HTML标记<b>)被回复的'value'

3 个答案:

答案 0 :(得分:5)

您可以使用标记包装文本。

<p><b>This text is bold</b>.</p>

http://www.w3schools.com/html/html_formatting.asp

答案 1 :(得分:5)

 <?php foreach ($options['attributes_info'] as $attribute) : ?>
 &nbsp;&nbsp;<?= $this->getPdfHelper()->fixEncoding($attribute['label']) ?> : <b><?= $this->getPdfHelper($attribute['value']) ?></b>
 <?php endforeach; ?> 

答案 2 :(得分:2)

您可以使用标记围绕它:

'<b>' . $attribute['value'] . '</b>'