PHP asks two simple questions about (json/php encryption)

Source: Internet
Author: User
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.