我试图通过我的 DOMDocument 对象选择没有类的图像。
我有以下
$imgParser=new DOMDocument;
@$imgParser->loadHTML($html);
foreach($imgParser->getElementsByTagName('img') as $imgNode){
//the code below will display images with and without class name
echo $imgParser->saveHTML($imgNode);
//I can't user javascript at this point...
//I need to save the images without class into my DB...
//save to DB codes..
}
有没有办法做到这一点?非常感谢!