废话不说还是一如既往的直接上代码!
基于THINKPHP调用SoapClient对象与JAVA接***互
用TP基础的人应该问题不大 可能写得不是特别好!但是基本思路是这样的
public function findCustomerInfo(){ $tel=I('tel',int); $name=I('name','htmlspecialchars'); $url="https://127.0.0.1:8080/findsalesrecordcustomer/services/Login.jws?wsdl"; $soap = new SoapClient($url); $result2 = $soap->findCustomerInfo($tel,$name); //调用JAVA暴露的方法并传值 $data=json_decode($result2,true); if (empty($name)|| empty($tel)) { $this->error($data['msg']); } if ($data['obj'][0]['username']=='') { $error="没有查询到信息,请查证后再在重新输入"; $this->error($error); } $bxtiom=$data['obj'][0]['salesdatetime']; $bxtiom=date("Y-m-d",strtotime("$bxtiom +10 year")); $data['obj'][0]['phone']=$tel; $this->data=$data; $this->bxtiom=$bxtiom; $this->display('select'); }