Implementazione array lista utenti
This commit is contained in:
21
index.php
21
index.php
@@ -1,6 +1,27 @@
|
||||
<?php
|
||||
class User{
|
||||
private $id;
|
||||
private $name;
|
||||
private $email;
|
||||
/*
|
||||
function set_details($id, $name, $email){
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->email = $email;
|
||||
}
|
||||
*/
|
||||
}
|
||||
$file = fopen("data/clienti.csv", "r") or die("Non riesco a leggere il file, controlla che esista brutto rimbambito");
|
||||
$utenti = [];
|
||||
|
||||
fgets($file);
|
||||
while (($linea = fgets($file)) !== false) {
|
||||
$campi = explode(",", $linea);
|
||||
array_push($utenti, new User($campi[0], $campi[1], $campi[2]));
|
||||
}
|
||||
fclose($file);
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
|
||||
Reference in New Issue
Block a user