try {
   // if(!empty($UserCode)){
   $url = '';
   $client = new \SoapClient($url);
   $userLogin = new \stdClass();

   $userLogin->UserCode = $UserCode;
   $userLogin->ExpirDate = 2;

   $loginResponse = $client->__call("GetToken", array(
       $userLogin
   ));
   $token = $loginResponse->GetTokenResult;
}catch(\Exception $e) {  //千万要注意这里的 \  很重要!!!否则不执行这里来
   $token = '';
}