찾다

 >  Q&A  >  본문

html5 - php怎么处理表单type为month类型的数据

前端post过来的数据如下

后台怎么对它进行处理。怎么跟数据库的时间字段进行对比。

PHP中文网PHP中文网2897일 전250

모든 응답(2)나는 대답할 것이다

  • PHP中文网

    PHP中文网2017-04-10 17:06:37

    你看这样行吗?希望对你有帮助

        $str = "Tue Mar 22 2016 15:07:48 GMT+0800 (中国标准时间)";
        $arr = explode("GMT+0800", $str);
        $time = strtotime($arr[0]);
        echo date("Y-m-d H:i:s", $time);

    회신하다
    0
  • 黄舟

    黄舟2017-04-10 17:06:37

    html5 input type=month 的表示形式是YYYY-MM,你这里的格式确认是month?
    https://www.w3.org/TR/html-markup/input.month.html
    http://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_month

    회신하다
    0
  • 취소회신하다