dongyunwei8596 2015-10-05 11:22 采纳率: 100%
浏览 52
已采纳

PHP如何在变量中使用html标签/实体?

I have content that I want to display in a textarea. And on a another page in a div. The content I got from inside my database. And was inserted in the database with CKeditor. Sound easy, right?

The problem is that when I use echo or print I am getting <b>Some content</b> instead of Some content.

Believe it or not I spend 6 hours already trying to solve this problem. What is normal amount for me to spend on a problem. Only normally I am at least one step closer solving the problem. But now I am still as clueless as I started.

And yes I am using: <meta charset="utf-8">

My code(Just a basic echo, since I don`t know what to do)

<textarea ><?php echo $content; ?></textarea>

Current output:

<li><s><em><strong><span class="marker">Dit is gewijzigd?</span></strong>

But I would like this:

Dit is gewijzigd?
  • 写回答

4条回答 默认 最新

  • dongqian1925 2015-10-05 11:28
    关注

    You may try it like this to make the content editable

    <div contenteditable><?php echo $content; ?></div>
    

    EDIT :

    try this

    <div><?php echo htmlspecialchars_decode($content); ?></div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug