class usermodel{
public $userList;
public $id;
public $name;
public function _init(){
$this->userList=include_once './123.php';
}
public function get_name(){
return $this->name;
}
public function get_user_info($userid){
foreach($this-> userList as $user){
if($userid==$user['id']){
return $user;
}
}
}
}
$model=new usermodel();
$model->_init();
$userinfo=$model->get_user_info(3);
var_dump($userinfo);
In this question, how to use tools to process multiple data forever