简体   繁体   English

链接未在数据库中正确显示

[英]Link is not showing properly from database

In my cakephp project I am trying to show a link from a database table. 在我的cakephp项目中,我试图显示数据库表中的链接。

Here is the text field. 这是文本字段。 Here I have sent a link in my database table 这里我在数据库表中发送了一个链接

在此输入图像描述

After Inserting this link my database table looks like the image below 插入此链接后,我的数据库表如下图所示

在此输入图像描述

Now the problem is when I want to see this link in my view page It's showing something like the image below 现在的问题是,当我想在我的视图页面中看到此链接时,它显示的内容如下图所示

在此输入图像描述

This is my view code -- 这是我的观点代码 -

<div>
    <p style="font-size: 1.0em;">
       <?php echo h($notice['Notice']['description']); ?>
      </p>
</div>

Now my questions are: 现在我的问题是:

How can I show the link? 我该如何显示链接?

Is there any role in mysql query for showing link? 在mysql查询中是否有任何显示链接的角色?

I have used data type text is this the right way? 我用过数据类型文本这是正确的方法吗?

Your HTML link is being escaped by the h function that your are using to print it. 您的HTML链接正由您用来打印它的h函数进行转义。

See http://api.cakephp.org/2.2/function-h.html http://api.cakephp.org/2.2/function-h.html

Text to wrap through htmlspecialchars 用于包装htmlspecialchars的文本

And what's htmlspecialchars? 什么是htmlspecialchars?

http://us2.php.net/htmlspecialchars http://us2.php.net/htmlspecialchars

It means it turns special characters which have meaning in html code into their entity representations, such as '>' for '>'. 这意味着它将具有html代码含义的特殊字符转换为实体表示形式,例如'>'代表'>'。 This means they are printed on screen the way they appear in the code instead of actually becoming HTML tags. 这意味着它们以在代码中出现的方式打印在屏幕上,而不是实际成为HTML标记。

Instead of running the data through the h function, simply echo it. 而不是通过h函数运行数据,只需回显它。

<div>
  <p style="font-size: 1.0em;">
     <?php echo $notice['Notice']['description']; ?>
  </p>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM