xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>PHP 数组转换为 JSON 格式数据 实例 - 自学教程(runoops.com)</title>
</head>
<body>
class Emp
{
public $name = "";
public $hobbies = "";
public $birthdate = "";
}
$e = new Emp();
$e->name = "sachin";
$e->hobbies = "sports";
$e->birthdate = date('m/d/Y h:i:s a', "7/29/2024 14:04:03 p");
$e->birthdate = date('m/d/Y h:i:s a', strtotime("7/29/2024 14:04:03"));
echo json_encode($e);
</body>
</html>