企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
~~~ <?php namespace app\index\controller; use app\index\model\Staff; class Index { public function index(){ //1.创建$data数组 $data['id'] = 10; $data['name'] = 'ThinkPHP'; $data['version'] = '5.0.3'; //2.用$data数组为参数实例化Staff类 $model = new Staff($data); //3.查看$model对象 dump($model); } } ~~~ 输出数据 ~~~ ["data":protected] => array(3) { ["id"] => int(10) ["name"] => string(8) "ThinkPHP" ["version"] => string(5) "5.0.3" } ~~~