怎么用php获得时间,然后存入mysql,mysql的时间类型是date
需要准备的材料分别是:电脑、php编辑器、浏览器。
1、首先打开mysql查询器,例如以c1表add_time字段为例。
3、在index.php中,输入代码:$date = date('Y-m-d');$conn = new mysqli('localhost', 'root', '', 'test');$sql = 'update c1 set add_time="' . $date . '"';$conn->query($sql);。