如何在MySQL数据库文本字段中创建粗体数据? [英] How to create Bold data in MySQL database text field?

查看:613
本文介绍了如何在MySQL数据库文本字段中创建粗体数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在MySQL数据库文本表字段中创建粗体文本?

我们将我们的文章放在我们的数据库中,我想创建大胆的标题和字幕。这可能吗?谢谢

解决方案

Markdown



我建议你使用markdown风格的格式( PHP / 。NET ),这将意味着粗体文本将以这样的形式存储:

  **我是大胆的** 



存储HTML



如果您不能在项目中使用降价,您也可以存储HTML - 我只是非常小心您存储的是什么标签。您不希望某人在您的数据库中发布< script /> 标签,例如:

 < strong>我是粗体< / strong> 



延迟造型



当您在网页上打印时,标题字幕字段中的值为



 < strong><?php print $ row-> title; ?>< /强> 


Is it possible to create bold text in a MySQL database text table field?

We are putting our articles in our database and I want to create bold titles and subtitles. Is this possible? Thanks

解决方案

Markdown

I would advise you to use a markdown-style formatting (PHP/.NET), which would mean bold-text would be stored like this:

**I am bold**

Storing HTML

If you can't use markdown on your project, you can store HTML as well - I would just be very careful about what tags you store. You wouldn't want somebody posting <script/> tags in your database for instance:

<strong>I am bold</strong>

Late-Styling

Or make all values from the title and subtitle fields bold when you print them on your page:

<strong><?php print $row->title; ?></strong>

这篇关于如何在MySQL数据库文本字段中创建粗体数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆