wei = 8; } /** *查询ect余额 * * @return void */ public function get_Balance(){ $address = $this->getCoinbase();//trim(input('post.address')); $this->web3->eth->getBalance($address , function ($err, $balance) { if ($err !== null) { exit(jsonReturn($err->getMessage())); // echo 'Error: ' . $err->getMessage(); //return; }else{ $my_balance = $balance->toString(); $my_balance = $my_balance/pow(10,$this->wei); $data['balance'] = $my_balance; exit(jsonReturn('',1,$data)); } }); } }