PHP 字符串编码错误
我正在尝试获取以下代码来输出带有 Google Static Maps API http://code.google.com/apis/maps/documentation/staticmaps/#Imagesizes...结果是除了 $address 之外的所有内容都已成功输出。我做错了什么?
function event_map_img($echo = true){
global $post;
$address = get_post_meta($post->ID, 'date_address', true);
if($echo): echo '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />';
else:
return '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />';
endif;
}
I'm trying to get the following code to output an IMG tag with the URL for Google Static Maps API http://code.google.com/apis/maps/documentation/staticmaps/#Imagesizes embedded in there... the result is that everything except the $address is being output successfully... what am I doing wrong?
function event_map_img($echo = true){
global $post;
$address = get_post_meta($post->ID, 'date_address', true);
if($echo): echo '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />';
else:
return '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />';
endif;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
我认为您在
blue|label:X|
之后缺少$address
的&
分隔符,它应该是这样的:I think you are missing the
&
separator for$address
afterblue|label:X|
, it should be like: