When there is multiple user data, how to use classes to handle multiple
落叶.
落叶. 2019-08-11 14:57:18
0
0
797

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

落叶.
落叶.

reply all (0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!