我有一个脚本可以为我嵌入代码。我使用的是php简单的html dom解析器。我使用的代码是这样的:
foreach ($html->find('object embed') as $embedCode)
{
echo $embedCode;
}
和输出是:
<embed width="100%" height="320" flashvars="config=http://server0.stream2k.com/playerjw/vConfigCdn.php?vkey=c2053010dadfdd331145"
allowfullscreen="true" allowscriptaccess="always"
src="http://server0.stream2k.com/playerjw/player-licensed56.swf"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" wmode="transparent">
但它在我的浏览器中显示为闪存屏幕。我想将其打印为单个字符串。
任何人都可以告诉我如何才能将其作为单个字符串而不是视频屏幕。
提前致谢
GetMovie()的返回:
<embed wmode="transparent" type="application/x-shockwave- flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
src="http://server0.stream2k.com/playerjw/player- licensed56.swf"
width="100%" height="320" allowscriptaccess="always" allowfullscreen="true" flashvars="config=http://server0.stream2k.com/playerjw/vConfigCdn.php?vkey=f3513b19d1149102e116" />
答案 0 :(得分:2)
使用htmlspecialchars:
foreach ($html->find('object embed') as $embedCode)
{
echo htmlspecialchars($embedCode);
}
答案 1 :(得分:1)
尝试将输出字符串放在htmlspecialchars中:echo htmlspecialchars($embedCode);
答案 2 :(得分:0)
您可以尝试这样的事情:
<pre>
<embed width="100%" height="320" flashvars="config=http://server0.stream2k.com/playerjw/vConfigCdn.php?vkey=c2053010dadfdd331145"
allowfullscreen="true" allowscriptaccess="always"
src="http://server0.stream2k.com/playerjw/player-licensed56.swf"
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent">
</pre>
答案 3 :(得分:0)
尝试在“for”循环之前添加此内容:
echo '<xmp>';
这将回显所有字符,但不显示为HTML代码。