使用带有php变量的Img源代码

时间:2012-09-28 18:33:27

标签: php

我想在WP循环中使用一些拇指拍生成的图像,代码如下:

if (!$thumbnail && wpbdp_get_option('use-default-picture'))
    $thumbnail = 'http://images.thumbshots.com/image.aspx?cid=xxxxxxxxxx&v=1&w=283&url=URLHERE';

URLHERE由此生成:

如何将URLHERE事物替换为:

的输出(输出和URL)
<?php echo wpbusdirman_the_listing_meta('single'); ?>

我在php上非常糟糕。

谢谢,

2 个答案:

答案 0 :(得分:1)

$thumbnail = 'http://images.thumbshots.com/image.aspx?cid=HIPFHapOLHw%3d&v=1&w=283&url='.urlencode(wpbusdirman_the_listing_meta('single'));

答案 1 :(得分:0)

URL对返回值进行编码!!你把一个URL放到一个URL中 - 如果你没有URLEncode它,你要求的不仅仅是一点麻烦。 我相信它很简单:

<?php echo urlencode(wpbusdirman_the_listing_meta('single')); ?>

:)