I have a MySQL table that contains IP addresses: Table IP addresses
When I loop the addresses in PHP, they'll be truncate:
string(3) "192"
string(3) "192"
string(3) "192"
string(2) "80"
My code: public function getListaIndirizzi(Request $request) {
// Paginazione
if (!$request) {
$validator = Validator::make($request->all(), [
"indirizzo1" => "ip",
"indirizzo2" => "ip"
]);
if ($validator->fails()) {
return redirect()->back()->withInput()->withErrors($validator);
}
$indirizzi = IP::whereBetween("IP", [$request->get("indirizzo1"), $request->get("indirizzo2")])->paginate(10);
} else {
$indirizzi = IP::paginate(10);
}
for($i =0; $i < count($indirizzi); $i++) {
LogController::debug((string)($indirizzi[$i]["IP"]));
}
die;
return view("lista_indirizzi", ["indirizzi" => $indirizzi]);
}
I use Laravel framework
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire