我在使用laravel插入数据时遇到了一些迁移问题。我得到以下错误:
errorexception:未初始化的字符串偏移量:16
我不明白为什么,这是我的密码:
//above is curl codes with no problem there
$veri = curl_exec($curl);
preg_match_all('@cassette-header">(.*?)<a href="/(.*?)"@si', $veri, $url);
$say = count($url[2]);
if($say > 0) {
for ($i=0; $i<$say; $i++) {
$link ="https://suumo.jp/".$url[2][$i];
$address = $veri = file_get_contents($link);
preg_match_all('@<h1>(.*?)</h1>@si',$address, $bina);
$name = strip_tags(trim($bina[0][0]));
preg_match_all('@<span class="l-quickright">(.*?)<span class="l-quickright-item">@si',$address, $adres);
$addr = strip_tags(trim($link = $adres[0][0]));
preg_match_all('@<span class="l-quickright">(.*?)<span class="l-quickright-item">@si',$veri, $genislik);
$extent = strip_tags(trim($genislik[0][2]));
preg_match_all('@<td class="detailtable-body">(.*?)</td>@si',$veri, $extentwo);
$extenttwo = strip_tags(trim($extentwo[0][3]));
preg_match_all('@<td class="detailtable-body">(.*?)</td>@si',$veri, $fiyat);
$rent = strip_tags(trim($fiyat[0][4]));
preg_match_all('@<td class="detailtable-body">(.*?)</td>@si',$veri, $buy);
$time = strip_tags(trim($buy[0][5]));
preg_match_all('@<td class="detailtable-body">(.*?)</td>@si',$veri, $buytwo);
$timetwo = strip_tags(trim($buytwo[0][6]));
$data[] = [
'Links' => $link[$i],
'Building Names' => $name[$i],
'Addresses' => $addr[$i],
'Rooms' => $extent[$i],
'Extents' => $extenttwo[$i],
'Rents' => $rent[$i],
'Sales Start' => $time[$i],
'Move In' => $timetwo[$i],
];
}
}
DB::table('estates')->insert($data);
我得到“错误异常:未初始化字符串偏移量:16”错误。但我不明白为什么?谢谢你的帮助!
暂无答案!
目前还没有任何答案,快来回答吧!