用静态字符串前缀数组
问题描述:
我的理解是,对你来说这看起来很容易,但对我来说,似乎我必须从初学者开始移山。我有以下while循环:用静态字符串前缀数组
$rows = array();
while($r = mysql_fetch_assoc($result)) {
$images[]=$r['images'];
$content=$r['content'];
}
该循环打印MySQL数据库查询的“内容”列。我得到的是一个相对URL,我想在每个“图像”结果前添加“http://offercat.com/media/com_jbusinessdirectory/pictures”作为前缀,以便将其转换为绝对URL。
有关于此的任何想法?
预先感谢您。
答
你可以在php中连接字符串.
。所以它看起来像这样:
$images[] = "http://offercat.com/media/com_jbusinessdirectory/pictures".$r['images'];
Concatenation?! – Rizier123
[php String Concatenation,Performance]的可能重复(http://*.com/questions/124067/php-string-concatenation-performance) –