PHP interface code of the online payment platform of Yibao, and online payment by Yibao
This code refers to the last five lectures on videos from Han shunping 149. For more information, see this code.
Here is the test image:
The Code section is as follows:
1 <? Php 2 3 4 function HmacMd5 ($ data, $ key) 5 {6 7 // the environment must be configured to support iconv, otherwise Chinese parameters cannot be processed normally 8 $ key = iconv ("GB2312", "UTF-8", $ key); 9 $ data = iconv ("GB2312", "UTF-8 ", $ data); 10 $ B = 64; 11 if (strlen ($ key)> $ B) {12 $ key = pack ("H *", md5 ($ key); 13} 14 $ key = str_pad ($ key, $ B, chr (0x00); 15 $ ipad = str_pad ('', $ B, chr (0x36); 16 $ opad = str_pad ('', $ B, chr (0x5c); 17 $ k_ipad = $ key ^ $ ipad; 18 $ k_opad = $ key ^ $ opad; 19 return md5 ($ k_opad. pack ("H *", md5 ($ k_ipad. $ data); 20} 21 // how do we generate a signature string for the ebao payment request? 22 // each request parameter is passed as $ data: $ key is the key 23 24 that Yibao assigns to sellers?>Common. php 1