PHP Wordpress 报价问题
问题描述:
有引号问题,需要第二双眼睛!
Having a quotes issue, need a second pair of eyes!
echo "<img src='" . bloginfo('template_url') . "img/" . $f['mainImage'] . ".png' />";
使用wordpress函数bloginfo获取主题路径!
Using the Wordpress function bloginfo to get the theme path!
我得到的只是打印在页面上的路径,没有图像!
All i'm getting is the path printed out on the page, no image!
谢谢
什么是输出:
http://www.example.co.uk/wp-content/themes/example
<img src="/img/digital.png">
答
bloginfo()
函数执行自己的回显.
The function bloginfo()
performs its own echo.
http://codex.wordpress.org/Function_Reference/bloginfo
在您的情况下,您将使用以下代码:
In your situation, you would use this code:
echo "<img src='"; bloginfo('template_url'); echo "img/" . $f['mainImage'] . ".png' />";