2016-04-29 108 views
-1

我在我的网站中动态地从数据库中获取字符串,其中包含完整的HTML代码,我需要将此字符串html显示到新的浏览器窗口,并告诉我如何执行此操作。字符串html到浏览器窗口

<html> 
.............. 
.............. 
<a href="#">link</a> (when click link it render value from db that contains whole html page, I am already in html page, how to show this extra html page) 
.............. 
.............. 
</html> 

注:我知道呼应,用于显示到浏览器的HTML元素命令,但我的情况是不同的。例如已经有body标签,并写入css,js,jquery的body标签,当我从db中呈现html字符串,然后使用echo时,它会在我的网站上添加一个body标签,所以它会与旧版本产生冲突。

+0

要显示一个页面的完整HTML的数据库里面? – 2016-04-29 04:13:23

+0

'echo $ string;' – 2016-04-29 04:14:30

+0

'echo htmlentities($ string);' – user2182349

回答

-1

,你可以在你的链接申报任何变量存储的价值和使用echo功能

+0

我有更新我的问题,请检查 –

-1

要在新窗口中打开网页,使用target =“_空白”。这将根据您的浏览器在新窗口或新选项卡中打开您的链接。

<!DOCTYPE html> 
<html> 
<body> 

<a href="new page url" target="_blank">Link to new window</a> 

</body> 
</html> 
+0

我没有网址,只有PHP字符串变量包含HTML(它不是一个文件,只有变量) –

+0

如果你有一个PHP变量的网址,你可以做这样的事情追加变量你的html行:'<?php echo“Link to new window”; ?> – almostcolin

+0

对不起,我误解了这个问题。检查此[链接](http://stackoverflow.com/questions/9399354/how-to-open-a-new-window-and-insert-html-into-it-using-jquery)看看如何打开一个新窗口并使用jQuery插入html。 – almostcolin