将当前日期时间插入自定义wordpress日期时间列

时间:2019-06-20 06:44:41

标签: php mysql wordpress datetime

我在将当前日期时间插入自定义wordpress日期时间列时遇到问题。我使用过curent_time函数,我也使用过date('Y-m-d H:m:s')作为列的值,但是它不起作用。

对于任何建议,我都会提供我的代码:

global $wpdb;
$load_rec_table = $wpdb->prefix.'load_rec';
// Insert into load record table
$wpdb->insert($load_rec_table,array(
    'rec_date' => current_time('mysql'),
    'total_load' => $_POST['totalPower'],
    'total_gap' => $_POST['totalGap'],
    'carriage' => $_POST['carriage']
    ));

1 个答案:

答案 0 :(得分:0)

您可以使用Mysq的NOW()或CURRENT_TIMESTAMP()函数 l

    config.skin = 'office2013';
config.toolbar = [
    { name: 'document', items: ['Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates'] },
    { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
    { name: 'editing', items: ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt'] },
    { name: 'forms', items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'] },
    '/',
    { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat'] },
    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
    { name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
    { name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe'] },
    '/',
    { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
    { name: 'colors', items: ['TextColor', 'BGColor'] },
    { name: 'tools', items: ['Maximize', 'ShowBlocks'] },
    { name: 'about', items: ['About'] }
];
config.removeButtons = 'Strike,Styles,Save,NewPage,Print';
config.removePlugins = 'elementspath';

config.font_defaultLabel = 'Georgia';
config.fontSize_defaultLabel = '11px';

config.allowedContent = true;
config.enterMode = CKEDITOR.ENTER_BR;