loadXML($xmltext); $array_e = $xml->getElementsByTagName('Encrypt'); $array_a = $xml->getElementsByTagName('ToUserName'); $encrypt = $array_e->item(0)->nodeValue; $tousername = $array_a->item(0)->nodeValue; return array(0, $encrypt, $tousername); } catch (\Exception $e) { return array(ErrorCode::$ParseXmlError, null, null); } } public function generate($encrypt, $signature, $timestamp, $nonce) { $format = " %s "; return sprintf($format, $encrypt, $signature, $timestamp, $nonce); } } ?>