当前位置:网站首页>TP & smart use diary

TP & smart use diary

2022-07-23 17:49:00 Ideal coder

stay smarty Make the timestamp mature / month / Day format :

{$v.goods_create_time|date_format:"%Y-%m-%d %H:%M:%S"}

stay tp Get constants that can be used provided by the system :

get_defined_constants(true);

Database operation :

creat() Method

//add() Method to add records using the array method 
$user = new M('user');
$arr = array(
    'field1' => 'v1',
    'field2' => 'v2',
    'field3' => 'v3',
);
$user->add($arr);

create() Method

if(isset($_POST)){
    $user = new M('user');
    $user->create();
    $user->add();
}

save() Method

$user = new M('user');
$arr = array(
    'field1' => 'v1',
    'field2' => 'v2',
    'field3' => 'v3',
);
$user->save($arr);
// No conditions set , Talk about modifying all records in the database ,tp The framework should not allow this 
// You can set where() Conditions 
// Such as :
//$user->where("goods_price>1000")->save($arr);
原网站

版权声明
本文为[Ideal coder]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207231503330595.html