如何从数据库文本中读取HTML链接 [英] How to read HTML link from database text

查看:135
本文介绍了如何从数据库文本中读取HTML链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MSSQL表,在我已经插入我的消息的字段中(例如:有一个美好的一天)与外部网站链接到谷歌。虽然我在我的html表格中绑定数据(有一个美好的一天www.google.com)值显示在视图中,它工作正常,但我点击该外部网络链接谷歌。它没有浏览谷歌页面。



我曾在SQL服务器上尝试过Html不同类型链接标签,我把这个标签放入数据库,那些标签单独使用消息和链接也可以看到。

I have a MSSQL table, in a field I had inserted my messages (ex:Have a good day) with external website link to Google. while I bind the data in my html table like this (have a good day www.google.com) values are shown into view, it is working fine, but while I click on that external web linkGoogle. it doesn't navigate google page.

I had tried in SQL server with Html different type to link tags, what are that tag I had put into database, those tag also get visible alone with message and link.

推荐答案

使用HtmlEncode在数据库和HtmlDecode中编码和存储HTML,以解码从数据库中检索到的编码HTML。详细信息: HtmlEncode和HtmlDecode [ ^ ]

至于在HTML中创建超链接,请查看: http://www.w3schools.com/html/html_links.asp [ ^ ]
Use HtmlEncode to encode and store HTML in database and HtmlDecode to decode the encoded HTML retrieved from the database. Detail in:HtmlEncode and HtmlDecode[^]
As for creating hyperlink in HTML, check this out: http://www.w3schools.com/html/html_links.asp[^]


你必须使用这样的信息在你的前端建立超链接。



< a href =http://www.google.comtarger =_ blank>祝你有个美好的一天www.google.com< / a>
You have to build hyperlink in your front end using the message like this.

<a href="http://www.google.com" targer="_blank">have a good day www.google.com</a>


这篇关于如何从数据库文本中读取HTML链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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