【发布时间】:2022-01-18 19:59:25
【问题描述】:
我现在下达命令:
<?php echo str_ireplace( $url['word']['word'] , ( '<strong>' . $url['word']['word'] . '</strong>' ) , $url['word']['question'] ); ?></p>
我在我的网站的“每日词汇”部分使用它。目的是在网页上查看时,正在使用的单词以粗体显示。例如:
What is the next **Aspiration** in your life you are working towards?
我真正想做的是找到一种更好的方法来在当天的单词周围插入<strong> 标签。目前,我已经将单词全部大写。我对在实际表格中包含 HTML 犹豫不决,因此我可以根据将来的任何编程更改适当地格式化它。在上面的例子中,Aspiration 是大写的。但是数据库中的“问题”是:
What is the next aspiration in your life you are working towards?
我的数据库表结构是:
reference bigint
word text
question text
add_date timestamp with time zone
membership_reference
有没有更好的方法来添加<strong> 和</strong> 标签?
【问题讨论】:
标签: php html search str-replace