加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 致命错误:调用未定义的方法DateTime :: createfromforma

发布时间:2020-12-13 13:17:16 所属栏目:PHP教程 来源:网络整理
导读:你如何解决以下错误: Fatal error: Call to undefined method DateTime::createfromformat() 错误发生在第35行.这是我的代码从第31行到第45行读取的内容 // check database for necessary updates$update = mysql_query("SELECT * FROM rent WHERE colour='
你如何解决以下错误:
Fatal error: Call to undefined method DateTime::createfromformat()

错误发生在第35行.这是我的代码从第31行到第45行读取的内容

// check database for necessary updates

$update = mysql_query("SELECT * FROM rent WHERE colour='#3C0'");
while($row_update = mysql_fetch_array( $update )) {
    $datetime_lower   = DateTime::createFromFormat('d/m/Y',$min);
    $datetime_upper   = DateTime::createFromFormat('d/m/Y',$max);
    $datetime_compare = DateTime::createFromFormat('d/m/Y g:i a',$row_update['pDate']);
    if ($datetime_lower < $datetime_compare && $datetime_upper > $datetime_compare) {
        // date is between do nothing
    } else {
        // date is not between so update
        $update_result = mysql_query("UPDATE rent SET colour='#F0F0F0' WHERE id=" . $row_update['id'] . " && colour='#3C0'");
        mysql_close($update_result);
    }
}

我该如何解决这个问题?

DateTime::createFromFormat()是在php 5.3中引入的.而且很可能你的年龄较大.所以 – 安装php> = 5.3,你就可以了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读