php function集合
生活随笔
收集整理的這篇文章主要介紹了
php function集合
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
/*更新商品的某個字段*/ function update_goods($goods_id, $field, $value) {if ($goods_id){/* 清除緩存 */clear_cache_files();$sql = "UPDATE " . $GLOBALS['ecs']->table('goods') ." SET $field = '$value' , last_update = '". gmtime() ."' " ."WHERE goods_id " . db_create_in($goods_id);return $GLOBALS['db']->query($sql);}else{return false;} } function message($msg, $url = NULL, $type = 'succeed', $waitSecond = 2) {if ($url == NULL)$url = 'javascript:history.back();';if ($type == 'error') {$title = '錯誤信息';} else {$title = '提示信息';}$data ['title'] = $title;$data ['message'] = $msg;$data ['type'] = $type;$data ['url'] = $url;$data ['second'] = $waitSecond;$this->assign('data', $data);$this->display('message');exit();}// 彈出信息 function alert($msg, $url = NULL, $parent = false) {header("Content-type: text/html; charset=utf-8");$alert_msg = "alert('$msg');";if (empty($url)) {$gourl = 'history.go(-1);';} else {$gourl = ($parent ? 'parent' : 'window') . ".location.href = '{$url}'";}echo "<script>$alert_msg $gourl</script>";exit();}
?
轉(zhuǎn)載于:https://www.cnblogs.com/wesky/p/5887961.html
總結(jié)
以上是生活随笔為你收集整理的php function集合的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。