PHP JSON Interface Demo

Source: Internet
Author: User

[PHP]View PlainCopy 
  1. <?php
  2. Class Student
  3. {
  4. public $no;
  5. public $username;
  6. public $password;
  7. }
  8. $student =new Student ();
  9. $student->no=11;
  10. $student->username=' xxx ';
  11. $student->password=' hehe ';
  12. Echo Json_encode ($student);
  13. $result =Array (
  14. ' no ' =$student->no,
  15. ' password ' =$student->password,
  16. ' username ' =$student->username
  17. );
  18. Echo Json_encode ($result);
  19. $arr =Array ();
  20. Array_push ($arr,$student);
  21. $student =new Student ();
  22. $student->no=12;
  23. $student->username=' FDSADF ';
  24. $student->password=' haha ';
  25. Array_push ($arr,$student);
  26. $student =new Student ();
  27. $student->no=13;
  28. $student->username=' xx ';
  29. $student->password=' haha Chinese ';
  30. Array_push ($arr,$student);
  31. Echo Json_encode ($arr);
  32. ?>

PHP gets MD5 SHA1 and tokens

[PHP]View PlainCopy  
  1. <?php
  2. Date_default_timezone_set (' PRC ');
  3. $STR =Date ("y-m-d", Time ());
  4. echo $str;
  5. echo ' <br/> ';
  6. $result =' ws '.   $STR;
  7. echo $result;
  8. echo ' <br/> ';
  9. $result =md5 ($result);
  10. echo $result;
  11. echo ' <br/> ';
  12. $authaccesstoken =sha1 (' ws ').   $result);
  13. echo $authaccesstoken;
  14. echo ' <br/> ';
  15. ?>

PHP JSON Interface Demo

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.