- <?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
- 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/>';
- ?>