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='哈哈';
  25. array_push($arr,$student);
  26. $student=new Student();
  27. $student->no=13;
  28. $student->username='xx';
  29. $student->password='哈哈中文';
  30. array_push($arr,$student);
  31. echo json_encode($arr);
  32. ?>

PHP 获取md5 sha1 和token

  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接口demo的更多相关文章

  1. JSON 接口如何实现 RSA 非对称加密与签名

    代码地址如下:http://www.demodashi.com/demo/14000.html 一.概述 1. 数字签名的作用:保证数据完整性,机密性和发送方角色的不可抵赖性,加密与签字结合时,两套公 ...

  2. SpringBoot-(2)-Web的json接口,静态网页,动态页面

    一, 了解注解@Controller和@RestController @Controller:处理Http请求 @RestController:Spring4以后新增注解,相当于@Controller ...

  3. Loadrunner模拟JSON接口请求进行测试

    Loadrunner模拟JSON接口请求进行测试     一.loadrunner脚本创建 1.Insert - New step -选择Custom Request -  web_custom_re ...

  4. 各种常用的JSON接口,开动你的大脑你就可以做出各种应用,值得收藏

    各种常用的JSON接口,开动你的大脑你就可以做出各种应用,值得收藏   浏览:1412 发布日期:2014/01/27 分类:技术分享 这里为大家搜集了一些能够返回JSON格式的服务接口.部分需要用J ...

  5. Loadrunner测试json接口

    1. loadrunner + json说明 使用lr测试json接口,向服务端发送json格式请求,接收处理返回响应数据. 主要用到函数: 1)web_custon_request 2)web_re ...

  6. 中国天气网 JSON接口的城市编码解析及结果

    最近在弄一个Android应用,其中一个功能是天气情况展示,准备使用google的天气API服务(http://www.google.com/ig/api?hl=zh-cn&weather=, ...

  7. 纯CSS菜单样式,及其Shadow DOM,Json接口 实现

    先声明,要看懂这篇博客要求你具备少量基础CSS知识, 当然如果你只是要用的话就随便了,不用了解任何知识 完整项目github链接:https://github.com/git-Code-Shelf/M ...

  8. Jquery Mobile实例--利用优酷JSON接口读取视频数据

    本文将介绍,如何利用JqueryMobile调用优酷API JSON接口显示视频数据. (1)注册用户接口. 首页,到 http://open.youku.com 注册一个账户,并通过验证.然后找到A ...

  9. jmeter--基于http+json接口的功能测试

    jmeter--基于http+json接口的功能测试 测试项目叫做smile_task,简称sm_task.这是一个基于nodejs超简单的todo list,sm_task没有任何UI界面(纯接口) ...

随机推荐

  1. JVM中垃圾回收机制如何判断是否死亡?详解引用计数法和可达性分析 !

    因为热爱,所以坚持. 文章下方有本文参考电子书和视频的下载地址哦~ 这节我们主要讲垃圾收集的一些基本概念,先了解垃圾收集是什么.然后触发条件是什么.最后虚拟机如何判断对象是否死亡. 一.前言   我们 ...

  2. Xcode - 添加文档注释插件

    Xcode自动添加文档注释插件: https://github.com/onevcat/VVDocumenter-Xcode 功能演示: 感谢onevcat的分享!

  3. C语言:signed和unsigned的区别

    参考博客:https://blog.csdn.net/wen381951203/article/details/79922220 signed和unsigned用于修饰整数类型(包括char,从ANS ...

  4. PTA数据结构与算法题目集(中文) 7-27

    PTA数据结构与算法题目集(中文)  7-27 7-27 家谱处理 (30 分)   人类学研究对于家族很感兴趣,于是研究人员搜集了一些家族的家谱进行研究.实验中,使用计算机处理家谱.为了实现这个目的 ...

  5. 版本控制,svn基础,实战案例,RPM打包

                                                   版本控制,svn基础,实战案例,RPM打包 案例1:Subversion基本操作 案例2:使用Subver ...

  6. GitHub 热点速览 Vol.15:Background-Matting 让你秒变专业抠图师

    作者:HelloGitHub-小鱼干 摘要:如果要选一个词来概述上周的热点,春风拂过,应该是一个不错的词.新项目像春天冒出的枝芽,朝气蓬勃,虽然获得的 star 不如之前三维 Vim 抢眼,但胜在多姿 ...

  7. Hadoop(三)HDFS写数据的基本流程

    HDFS写数据的流程 HDFS shell上传文件a.txt,300M 对文件分块,默认每块128M. shell向NameNode发送上传文件请求 NameNode检测文件系统目录树,看能否上传 N ...

  8. 谁给你说的 Ubuntu 不可以输入中文

    文章更新于:2020-04-04 按照惯例,需要的文件附上链接放在文首 文件名:sogoupinyin_2.3.1.0112_amd64.deb 文件大小:25.5 MB 下载链接:https://w ...

  9. ThinkPHP3.1.2 使用cli命令行模式运行

    ThinkPHP3.1.2 使用cli命令行模式运行 标签(空格分隔): php 前言 thinkphp3.1.2 需要使用cli方法运行脚本 折腾了一天才搞定 3.1.2的版本真的很古老 解决 增加 ...

  10. C语言中 sinx cosx 的用法

    #include<stdio.h> #include<math.h> int main() {     double pi=acos(-1.0);     double ang ...