开发者

php xml simple problem

开发者 https://www.devze.com 2023-02-11 04:52 出处:网络
I have this php code from a wordpress theme <?php .... $image_source = bloginfo(\'template_url\').\'/timthumb.php?src=\'.$slider_images[$i].\'&w=940&h=400&zc=1\';

I have this php code from a wordpress theme

<?php 

....

$image_source = bloginfo('template_url').'/timthumb.php?src='.$slider_images[$i].'&w=940&h=400&zc=1';
echo "<Image Source='".$image_source."'></I开发者_开发百科mage>";

....
?>

and the expected result is :

<Image Source='http://...timthumb.php?... .png'></Image>

instead of that i get this :

http://... <Image Source='/timthumb.php?.... .png'></Image>


The bloginfo function prints it's results directly. See reference.

What happens is that when you set $image_source then the bloginfo prints http://... and then returns void. The void value is concatenated with the image url that is '' . '/timthumb... Finally you print the text <image source...>.

You should use get_bloginfo instead

0

精彩评论

暂无评论...
验证码 换一张
取 消