duanliu8998 2015-02-28 08:47
浏览 26
已采纳

显示数据库中的PHP变量以及HTML

I want to display a row that contains a text and an image saved with a PHP Variable from a database.
Exemple:

Row contains: "Some text about something and then <img src="images/$img">"

When i try to echo it's displaying like a plain text
Exemple:

"Some text about something and then <img src="images/$img">" thus the $img = "test.png" and image should be echo like <img src="images/test.png">

  • 写回答

3条回答 默认 最新

  • doujing5937 2015-02-28 08:56
    关注

    You can replace that substring - but remember to use single quotes not to evaluate $img variable.

    $new_string = str_replace('$img', $img, $old_string);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验