A, generating the json data
This not too much difficulty in pb, according to the json format specifications, the data in the datastore to write a string cycles with respect to OK, don't spend much time
Second, json generated rows
This will speak some skills, datastore is a very important function: according to the XML format to import data, using the importstring () function, so, as long as the way to the XML file generated from the json string, quickly can be implemented, the key to deal with this problem is to parse the json, and spell into XML format, this just understand XML specification and json norms, patient string analysis, write cycle, the problem is not big, because in the datastore defines an XML format (a XML sketchpad) easily, so write a public function turn json into XML, and then in the XML sketchpad into XML template you generate template, this also can write their own, not to the Internet to find a plugin
The datastore generated from the json data rows, benefit very much, first of all, it is easy to do the update () operation; Second, it is easy to business logic, data, and we were using pb, not said
In this part, note that the XML reserved symbol escape: & lt; ,> , & amp; The three symbols must escape, or json once it is in the range of values, the three symbols are generated in the range of values of the XML, importstring () will be an error, what circumstance value contains the three symbols? Ha ha, not to be considered generally did not experience, let me tell you: that is the nickname WeChat users, or consignee name
Three, the encoding of the string conversion, and subdivided into base64 encoding and utf8 encoding
Pb in their dealings with the coding format, I summed up the points:
1. The blob () function to generate value is base64 encoding, use string (blob) decoding
2. If the other interface is base64 string, use a blob to receive in the pb script, and then use the string () to extract, if use type string to receive, will soon find it can't use string () to decode, by this time have to find the object of the third party, and not seek
Transcoding between 3. Utf8 and unicode, you need to use the string () function, and the string () is only in view of the blob is encoded transformation, so that the original data must use a blob to receive, then convert
If you can't achieve the freedom to encode conversion, PB basically out of the Internet: the PHP website interface, mostly utf8 encoding and mutual communication gibberish, don't have never
Solve the three aspects of things, it is easy to interface to interact with various web site program, it was the younger brother in the three aspects of knowledge, smoothly and WeChat part of interface interaction,
A bit of a mouthful, but when used carefully thinking, can understand
CodePudding user response:
Base64 string namely originally I think your 3.1 and 3.2 is wrongCodePudding user response:
The building Lord, what do WeChat interface?CodePudding user response:
Top, also pay attention to thisCodePudding user response:
Pb + WeChat I feel difficulty is not great, because WeChat encryption approach is simpler, I've seen alipay interface is more troublesome, because pay treasure with asymmetric keys, you need to use the public key private key to add solution to sign, this is estimated to have pb can not complete,CodePudding user response: