首页 > 代码库 > php json接口demo
php json接口demo
[php] view plain copy
- <?php
- class Student
- {
- public $no;
- public $username;
- public $password;
- }
- $student=new Student();
- $student->no=11;
- $student->username=‘xxx‘;
- $student->password=‘hehe‘;
- echo json_encode($student);
- $result=array(
- ‘no‘=>$student->no,
- ‘password‘=>$student->password,
- ‘username‘=>$student->username
- );
- echo json_encode($result);
- $arr=array();
- array_push($arr,$student);
- $student=new Student();
- $student->no=12;
- $student->username=‘fdsadf‘;
- $student->password=‘哈哈‘;
- array_push($arr,$student);
- $student=new Student();
- $student->no=13;
- $student->username=‘xx‘;
- $student->password=‘哈哈中文‘;
- array_push($arr,$student);
- echo json_encode($arr);
- ?>
PHP 获取md5 sha1 和token
[php] view plain copy
- <?php
- date_default_timezone_set(‘PRC‘);
- $str=date("Y-m-d",time());
- echo $str;
- echo ‘<br/>‘;
- $result=‘ws‘.$str;
- echo $result;
- echo ‘<br/>‘;
- $result=md5($result);
- echo $result;
- echo ‘<br/>‘;
- $authaccesstoken=sha1(‘ws‘.$result);
- echo $authaccesstoken;
- echo ‘<br/>‘;
- ?>
php json接口demo
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。