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
date_default_timezone_set('PRC');
$str=date("Y-m-d",time());
echo $str;
echo '
';
$result='ws'.$str;
echo $result;
echo '
';
$result=md5($result);
echo $result;
echo '
';
$authaccesstoken=sha1('ws'.$result);
echo $authaccesstoken;
echo '
';
?>