php dom problem
hello I'm new to PHP programming a开发者_C百科nd I migrated from ASP .net to PHP..
I have a div just like below
<div id="mydiv"></div>
what I wanted to do is just to change the text and html content(like some name or any data in it) in it.
What I imagine is just like
mydiv=>innertext="some value";
Thanks, GURU
Are you trying to modify the div in the same page as the php? I don't think that's possible.
PHP runs at the server, and only sees content between the php tags.
If you're modifying dom content, it seems like javascript/jQuery is a better approach for this.
Otherwise, if you're modifying content that is hosted already, and plan output it to a different page, then you can use this:
PHP Simple HTML DOM Parser
$myDivText = "This is what goes inside mydiv";
echo "<div id=\"mydiv\">$myDivText</div>";
精彩评论