thinkphp
thinkphp copied to clipboard
where条件 时间字符串 :0 会被误认
用时间做为判断条件的话
$time = date('Y-m-d H:i:s', time() ); // 2016-12-02 15:04:53 D('Works')->where( array('created_at'=> array( 'elt', $time) ) )->save(array('status'=>-1));
string(19) "2016-12-02 15:04:53"
UPDATE yy_works
SET status
='-1' WHERE created_at
<= '2016-12-02 15'-1'4:53'
如果时间时分秒 中有:0 那么:0 会被认为 mysql的绑定 :0 执行错误的SQL