Php 基于div将其他网站的内容复制到您的
如果使用jQuery,则可以使用.html获取DOM元素的内容:Php 基于div将其他网站的内容复制到您的,php,html,simple-html-dom,Php,Html,Simple Html Dom,如果使用jQuery,则可以使用.html获取DOM元素的内容: require('simple_html_dom.php'); $html = file_get_html('new_arrival.html'); //$product = []; foreach ($html->find('div.wrap-desc') as $pro) { $proDetails = $pro->find('div.brand'); } 或者在vanillaJS中
require('simple_html_dom.php');
$html = file_get_html('new_arrival.html');
//$product = [];
foreach ($html->find('div.wrap-desc') as $pro) {
$proDetails = $pro->find('div.brand');
}
或者在vanillaJS中:
$('html').html()
如果您使用的是jQuery,那么它们不是。他们正在使用PHP的简单HTMLDOM。这是清楚地表明了问题上的标签和里面的代码。感谢Max,我不只是使用php和主要部门是产品瓷砖和其他品牌的价格,里面的图像也请提到foreach的这一点
$('html').html()
let x = document.getElementByTagName('html')
console.log(x.innerHTML)