<?php echo get_time(); function get_time(){ $today = date('w'); //今天周几 $array = array('日', '一', '二', '三', '四', '五', '六'); //规范化周日的表达 $count = ceil(date('d') / 7); //计算是第几个星期几 $value = array('time'=>date("Y年n月j日"),'week'=>'星期'.$array[$today],'weeks'=>'本月第'.$count.'个星期'); return json_encode($value,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE); }