问题
the following code:
<?
require_once "phpQuery.php";
$dom = phpQuery::newDocument( "<head></head><body>this is ignored</body>" );
echo nl2br( htmlentities( $dom ) );
?>
should give this is ignore, but the entire body seems to be ignored.
I stripped down the code to where the problem was still there. I want to read links ($dom->find('a'))
from the body, but found out nothing was found even though there were links in the body.
What am I doing wrong?
回答1:
Does phpquery require valid xml bodies? If so, you should wrap your document in a <html>
tag.
来源:https://stackoverflow.com/questions/6522438/phpquery-ignores-part-of-an-imported-file