PHP asks two simple questions (json/php encryption)
1: I see some big website source code There is always something like this
$t ={"Programmers": [
{"FirstName": "Brett", "LastName": "McLaughlin", "email": "AAAA"},
{"FirstName": "Jason", "LastName": "Hunter", "email": "BBBB"},
{"FirstName": "Elliotte", "LastName": "Harold", "email": "CCCC"}
],
"Authors": [
{"FirstName": "Isaac", "LastName": "Asimov", "Genre": "Science Fiction"},
{"FirstName": "Tad", "LastName": "Williams", "Genre": "Fantasy"},
{"FirstName": "Frank", "LastName": "Peretti", "Genre": "Christian Fiction"}
],
"Musicians": [
{"FirstName": "Eric", "LastName": "Clapton", "instrument": "Guitar"},
{"FirstName": "Sergei", "LastName": "Rachmaninoff", "Instrument": "Piano"}
] }
How do these JSON data work, and why not use the template when the full replacement, what good?
2:php want to encrypt two strings
First, the user-recognized session of the page how to deal with the more secure, pass the user name MD5 value plus a digit?
The second is to add a bunch of URLs behind the/gallery/abcdefg12345.jpg
JPG can be removed statically, this picture name add to what look good
------Solution--------------------
1, is the ordinary JSON string ah, you want to express what meaning, Json_encode,json_decode.
2, one, session on the service side, is originally safe. Two, can rewrite, but it makes sense, who will go to rewrite the static picture?
------Solution--------------------
Google:json database.
------Solution--------------------
Encryption is just a few, look at the useful come on the line, to advanced encryption that involves the key:
PHP Code
$str 1 = "abcabc123123";//plus a pure number or a plain letter $str2 = "I am Chinese";//Is this sentence also valid? Echo MD5 ($STR 1). "
"; #8709a6a92a8d441868d916b9ea2c07c2echo MD5 ($str 2). "
"; #512d1643ba2878bc9c9f8f4f492673dfecho UrlEncode ($str 1). "
"; #abcabc123123echo UrlEncode ($str 2). "
"; #%e6%88%91%e6%98%af%e4%b8%ad%e5%9b%bd%e4%ba%baecho Base64_encode ($str 1). "
"; #YWJjYWJjMTIzMTIzecho Base64_encode ($str 2). "
"; #5oiR5piv5Lit5Zu95Lq6