2013-08-17 67 views
0

经过3个多小时,谷歌搜索,我发现,脂肪酶做其他方式的我在做什么,但无论如何,这里是我想做的事:使嵌入HTML代码

我有一个其中包含HTML代码(嵌入谷歌地图代码),即

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" 
     marginwidth="0" src="https://www.google.com/maps/ms?........in a larger 
     map></iframe> 
现在

在PHP代码,变量$位置我怎样才能得到要显示的地图吗? 以下输出HTML代码为文本

<?php echo $loation; ?> 

谢谢!

+3

你把你的变量名拼写错了'$ loation;' - 应该是'$ location;'。假设你像'$ location ='...';'那样正确设置你的变量,你应该没问题。你可以在你设置变量的地方发布代码吗? – Revent

+0

大声笑,你是对的,它是$位置,并感谢提示,它被定义为$ info ['location'];而它应该是html_entity_decode($ info ['location'],ENT_QUOTES,'UTF-8'); – user2692586

+0

发表我的评论上面作为答案,所以你可以接受它。谢谢! – Revent

回答

1

您拼写错误的变量名称$loation; - 应为$location;。假设你正确设置你的变量像

$location = '...'; 

或使用heredoc语法:

$location = <<<STR 
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" 
     marginwidth="0" src="https://www.google.com/maps/ms?........in a larger 
     map></iframe> 
STR; 

你应该罚款。