test1(); echo "7766677767"; exit(); $list = Db::name('user')->where('status','normal')->select(); foreach ($list as $key => $value) { $amount = Db::name('transaction_record')->where('type',2)->where('user_id', $value['id'])->sum('amount'); $ret = Db::name('user')->where('id', $value['id'])->update(['profit_amount' => $amount]); var_dump($ret); } $this->success('请求成功!'); } public function test1(){ $x=5; // 全局变量 $y=10; // 局部变量 echo "
测试函数内变量:
";
echo "变量 x 为: $x";
echo "
";
echo "变量 y 为: $y";
}
}