doulan8846 2012-07-18 04:51
浏览 18
已采纳

Codeigniter Datamapper自动创建更新的字段

Seems like this should be the easy part, but I can't seem to get this going. My created and updated fields are not being populated. I've tried renaming the fields to something different, but no go. Other than the schema and setting up the class (very basic) as below, am I missing something?

Codeigniter v2.1.2 Datamapper ORM v1.8.2.1

Schema:

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1

User Class:

<?php

class User extends DataMapper
{

    function User()
    {
        parent::DataMapper();
    }

}
  • 写回答

2条回答 默认 最新

  • dsuxcxqep31023992 2012-07-18 16:06
    关注

    Ok, found the answer and hopefully this will help someone out. I needed to set the following in the application/config/datamapper.php file:

    $config['local_time'] = TRUE;
    $config['unix_timestamp'] = FALSE;
    $config['timestamp_format'] = 'Y-m-d H:i:s';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题