如何以 json 格式从 goutte 和 return 中抓取内部 html 标签数据
How to scrape inner html tag data from goutte and return in json format
我在laravel中使用过Goutte包
HTML代码
<div class="middle-stats">
<div class="wrap">
<div class="wrap-inner">
<ul class="mediaBodyStats">
<li><b>.1M</b> Price</li><li><b>47,503</b> Sqft</li><li><b>104.61</b> <div class="middle-stats middle-stats-mobile">
</div>
尝试以
访问所有列表项
private product_details = [];
$page->filter('.middle-stats')->each(function($item){
print_r($item->text());
array_push($this->product_details, $item->text());
});
如何从 laravel 控制器
向数组中添加列表数据
private product_details = [];
$page->filter('.mediaBodyStats > li')->each(function($item){
array_push($this->product_details, $item->text());
});
We can use inner html tags with ">" sign
我在laravel中使用过Goutte包 HTML代码
<div class="middle-stats">
<div class="wrap">
<div class="wrap-inner">
<ul class="mediaBodyStats">
<li><b>.1M</b> Price</li><li><b>47,503</b> Sqft</li><li><b>104.61</b> <div class="middle-stats middle-stats-mobile">
</div>
尝试以
访问所有列表项private product_details = [];
$page->filter('.middle-stats')->each(function($item){
print_r($item->text());
array_push($this->product_details, $item->text());
});
如何从 laravel 控制器
向数组中添加列表数据 private product_details = [];
$page->filter('.mediaBodyStats > li')->each(function($item){
array_push($this->product_details, $item->text());
});
We can use inner html tags with ">" sign