dongwei4444 2013-09-08 19:22
浏览 11
已采纳

使用PHP将HTML插入现有HTML文件

So I wanna insert an html element that I have as a string into an existing HTML file on the server. So I already have my string, I get a handle on the file using $handle = fopen("file.php", "rw"); and I want to add the string $content that contains the HTML in the existing file after the div element that has the id "inner_container".

What is the best way to do this ?

Let me know if you need code. Basically what I wanna do is insert HTML after a certain element that Id find using its id.

Thanks!

  • 写回答

2条回答 默认 最新

  • droc60607 2013-09-08 19:29
    关注

    You should try this one here :

    How can I use XPath and DOM to replace a node/element in php?

    Answer is all about your problem :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?