本文整理汇总了PHP中dround函数的典型用法代码示例。如果您正苦于以下问题:PHP dround函数的具体用法?PHP dround怎么用?PHP dround使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dround函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_list
function get_list($condition = '1', $order = 'addtime DESC')
{
global $MOD, $pages, $page, $pagesize, $offset, $sum;
if ($page > 1 && $sum) {
$items = $sum;
} else {
$r = $this->db->get_one("SELECT COUNT(*) AS num FROM {$this->table} WHERE {$condition}");
$items = $r['num'];
}
$pages = pages($items, $page, $pagesize);
if ($items < 1) {
return array();
}
$lists = array();
$result = $this->db->query("SELECT * FROM {$this->table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}");
while ($r = $this->db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['editdate'] = timetodate($r['edittime'], 5);
$r['title'] = set_style($r['title'], $r['style']);
$r['linkurl'] = $MOD['linkurl'] . rewrite('expert.php?itemid=' . $r['itemid']);
$r['rate'] = $r['answer'] && $r['best'] < $r['answer'] ? dround($r['best'] * 100 / $r['answer'], 2, true) . '%' : '100%';
$lists[] = $r;
}
return $lists;
}
示例2: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $TYPE, $_username, $_userid;
$post['editor'] = $_username;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['adddate'] = timetodate($post['addtime'], 3);
$post['edittime'] = $DT_TIME;
$post['editdate'] = timetodate($post['edittime'], 3);
$post['totime'] = $post['totime'] ? strtotime($post['totime'] . ' 23:59:59') : 0;
$post['fee'] = dround($post['fee']);
$post['price'] = dround($post['price']);
$post['minamount'] = dround($post['minamount']);
$post['amount'] = dround($post['amount']);
$post['mycatid'] = intval($post['mycatid']);
$post['days'] = intval($post['days']);
$post['elite'] = $post['elite'] ? 1 : 0;
$post['title'] = trim($post['title']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($MOD['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($MOD['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($MOD['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $MOD['introduce_length']));
}
if ($this->itemid) {
$new = $post['content'];
if ($post['thumb']) {
$new .= '<img src="' . $post['thumb'] . '">';
}
if ($post['thumb1']) {
$new .= '<img src="' . $post['thumb1'] . '">';
}
if ($post['thumb2']) {
$new .= '<img src="' . $post['thumb2'] . '">';
}
$r = $this->get_one();
$old = $r['content'];
if ($r['thumb']) {
$old .= '<img src="' . $r['thumb'] . '">';
}
if ($r['thumb1']) {
$old .= '<img src="' . $r['thumb1'] . '">';
}
if ($r['thumb2']) {
$old .= '<img src="' . $r['thumb2'] . '">';
}
delete_diff($new, $old);
} else {
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例3: set
function set($post)
{
global $MOD, $DT_TIME, $_username, $_userid;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['edittime'] = $DT_TIME;
$post['editor'] = $_username;
$post['groupid'] = isset($post['groupid']) && $post['groupid'] ? ',' . implode(',', $post['groupid']) . ',' : '';
$post['fee'] = dround($post['fee']);
return array_map("trim", $post);
}
示例4: get_mkt
function get_mkt($date, $market, $lists)
{
$n = $s = 0;
foreach ($lists as $v) {
if ($v['date'] == $date && $v['market'] == $market) {
$n++;
$s += $v['price'];
}
}
return $n ? dround($s / $n) : get_avg($lists);
}
示例5: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $TYPE, $_username, $_userid, $GENDER, $MARRIAGE, $EDUCATION;
is_url($post['thumb']) or $post['thumb'] = '';
$post['editor'] = $_username;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['edittime'] = $DT_TIME;
$post['fee'] = dround($post['fee']);
$post['birthday'] = intval($post['byear']) . '-' . intval($post['bmonth']) . '-' . intval($post['bday']);
$post['age'] = date('Y', $DT_TIME) - intval($post['byear']);
$post['minsalary'] = intval($post['minsalary']);
$post['maxsalary'] = intval($post['maxsalary']);
$post['type'] = intval($post['type']);
$post['marriage'] = intval($post['marriage']);
$post['height'] = intval($post['height']);
$post['height'] = intval($post['height']);
$post['gender'] = intval($post['gender']);
$post['education'] = intval($post['education']);
$post['experience'] = intval($post['experience']);
$post['situation'] = intval($post['situation']);
$post['status'] = intval($post['status']);
$post['open'] = intval($post['open']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($MOD['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($MOD['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($MOD['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $MOD['introduce_length']));
}
if ($this->itemid) {
$new = $post['content'];
if ($post['thumb']) {
$new .= '<img src="' . $post['thumb'] . '"/>';
}
$r = $this->get_one();
$old = $r['content'];
if ($r['thumb']) {
$old .= '<img src="' . $r['thumb'] . '"/>';
}
delete_diff($new, $old);
} else {
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例6: progress
function progress($sid, $fid, $tid)
{
if ($tid > $sid && $fid < $tid) {
$p = dround(($fid - $sid) * 100 / ($tid - $sid), 0, true);
if ($p > 100) {
$p = 100;
}
$p = $p . '%';
} else {
$p = '100%';
}
return '<table cellpadding="0" cellspacing="0" width="100%" style="margin:0"><tr><td><div class="progress"><div style="width:' . $p . ';"> </div></div></td><td style="color:#666666;font-size:10px;width:40px;text-align:center;">' . $p . '</td></tr></table>';
}
示例7: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $_username;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['editor'] = $_username;
$post['edittime'] = $DT_TIME;
$post['price'] = dround($post['price']);
if ($this->itemid) {
//
} else {
$post['ip'] = $DT_IP;
}
$post = dhtmlspecialchars($post);
return array_map("trim", $post);
}
示例8: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $_username, $_userid;
is_url($post['thumb']) or $post['thumb'] = '';
$post['filepath'] = isset($post['filepath']) && is_filepath($post['filepath']) ? file_vname($post['filepath']) : '';
$post['islink'] = isset($post['islink']) ? 1 : 0;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['edittime'] = $DT_TIME;
$post['fee'] = dround($post['fee']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($post['content'] && isset($post['clear_link']) && $post['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($post['content'] && isset($post['save_remotepic']) && $post['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($post['content'] && $post['thumb_no'] && !$post['thumb']) {
$post['thumb'] = save_thumb($post['content'], $post['thumb_no'], $MOD['thumb_width'], $MOD['thumb_height']);
}
if (strpos($post['content'], 'pagebreak') !== false) {
$post['content'] = str_replace(array('<hr class="de-pagebreak" /></p>', '<p><hr class="de-pagebreak" />', '<hr class="de-pagebreak" /></div>', '<div><hr class="de-pagebreak" />'), array('</p><hr class="de-pagebreak" />', '<hr class="de-pagebreak" /><p>', '</div><hr class="de-pagebreak" />', '<hr class="de-pagebreak" /><div>'), $post['content']);
}
if ($post['content'] && !$post['introduce'] && $post['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $post['introduce_length']));
}
if ($this->itemid) {
$post['editor'] = $_username;
$new = $post['content'];
if ($post['thumb']) {
$new .= '<img src="' . $post['thumb'] . '"/>';
}
$r = $this->get_one();
$old = $r['content'];
if ($r['thumb']) {
$old .= '<img src="' . $r['thumb'] . '"/>';
}
delete_diff($new, $old);
} else {
$post['username'] = $post['editor'] = $_username;
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例9: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $AREA, $_username, $_userid;
$AREA or $AREA = cache_read('area.php');
$post['city'] or $post['city'] = $post['areaid'] ? $AREA[$post['areaid']]['areaname'] : '';
is_url($post['thumb']) or $post['thumb'] = '';
$post['filepath'] = isset($post['filepath']) && is_filepath($post['filepath']) ? file_vname($post['filepath']) : '';
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['edittime'] = $DT_TIME;
$post['fromtime'] = strtotime($post['fromtime'] . ' 0:0:0');
$post['totime'] = strtotime($post['totime'] . ' 23:59:59');
$post['homepage'] = fix_link($post['homepage']);
$post['sign'] = $post['sign'] ? 1 : 0;
$post['fee'] = dround($post['fee']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($MOD['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($MOD['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($MOD['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $MOD['introduce_length']));
}
if ($this->itemid) {
$post['editor'] = $_username;
$new = $post['content'];
if ($post['thumb']) {
$new .= '<img src="' . $post['thumb'] . '"/>';
}
$r = $this->get_one();
$old = $r['content'];
if ($r['thumb']) {
$old .= '<img src="' . $r['thumb'] . '"/>';
}
delete_diff($new, $old);
} else {
$post['username'] = $post['editor'] = $_username;
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例10: http_upload
function http_upload($file)
{
$ext = file_ext($file);
$size = dround(filesize($file) / 1024);
if ($size < 1) {
return array('', 'invalid media file');
}
if ($ext == 'mp3' || $ext == 'amr') {
if ($size > 256) {
return array('', 'media file too large');
}
$type = 'voice';
} else {
if ($ext == 'mp4') {
if ($size > 1024) {
return array('', 'media file too large');
}
$type = 'video';
} else {
if ($ext == 'jpg') {
if ($size > 128) {
return array('', 'media file too large');
}
$type = 'image';
} else {
return array('', 'invalid media type');
}
}
}
$par = array();
$par['access_token'] = $this->access_token;
$par['type'] = $type;
$par['media'] = '@' . $file;
#$par = 'access_token='.$this->access_token.'&type='.$type.'&media=@'.$file;
$cur = curl_init('http://file.api.weixin.qq.com/cgi-bin/media/upload');
curl_setopt($cur, CURLOPT_POST, 1);
curl_setopt($cur, CURLOPT_POSTFIELDS, $par);
curl_setopt($cur, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($cur, CURLOPT_HEADER, 0);
curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($cur, CURLOPT_RETURNTRANSFER, 1);
#curl_setopt($cur, CURLOPT_HTTPHEADER, array('Expect: '));
$rec = curl_exec($cur);
curl_close($cur);
$arr = json_decode($rec, true);
return isset($arr['media_id']) ? array($arr['media_id'], $type) : array('', $arr['errmsg']);
}
示例11: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $_username, $_userid;
is_url($post['thumb']) or $post['thumb'] = '';
$post['filepath'] = isset($post['filepath']) && is_filepath($post['filepath']) ? file_vname($post['filepath']) : '';
$post['editor'] = $_username;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['edittime'] = $DT_TIME;
is_url($post['thumb']) or $post['thumb'] = '';
$post['fee'] = dround($post['fee']);
$post['down'] = fix_link($post['down']);
$post['down_width'] = intval($post['down_width']);
$post['down_height'] = intval($post['down_height']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($MOD['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($MOD['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($MOD['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $MOD['introduce_length']));
}
if ($this->itemid) {
$new = $post['content'];
if ($post['thumb']) {
$new .= '<img src="' . $post['thumb'] . '"/>';
}
$r = $this->get_one();
$old = $r['content'];
if ($r['thumb']) {
$old .= '<img src="' . $r['thumb'] . '"/>';
}
delete_diff($new, $old);
if ($r['fileurl'] != $post['fileurl']) {
delete_upload($r['fileurl'], match_userid($r['fileurl']));
}
} else {
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例12: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $TYPE, $_username, $_userid;
$post['editor'] = $_username;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['adddate'] = timetodate($post['addtime'], 3);
$post['edittime'] = $DT_TIME;
$post['editdate'] = timetodate($post['edittime'], 3);
$post['totime'] = $post['totime'] ? strtotime($post['totime'] . ' 23:59:59') : 0;
$post['fee'] = dround($post['fee']);
$post['total'] = intval($post['total']);
$post['email'] = trim($post['email']);
$post['minsalary'] = intval($post['minsalary']);
$post['maxsalary'] = intval($post['maxsalary']);
$post['type'] = intval($post['type']);
$post['gender'] = intval($post['gender']);
$post['education'] = intval($post['education']);
$post['experience'] = intval($post['experience']);
$post['minage'] = intval($post['minage']);
$post['maxage'] = intval($post['maxage']);
$post['title'] = trim($post['title']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($MOD['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($MOD['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($MOD['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $MOD['introduce_length']));
}
if ($this->itemid) {
$new = $post['content'];
$r = $this->get_one();
$old = $r['content'];
delete_diff($new, $old);
} else {
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例13: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $_username, $_userid;
$post['filepath'] = isset($post['filepath']) && is_filepath($post['filepath']) ? file_vname($post['filepath']) : '';
$post['editor'] = $_username;
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['edittime'] = $DT_TIME;
$post['totime'] = $post['totime'] ? strtotime($post['totime'] . ' 23:59:59') : 0;
$post['discount'] = dround($post['price'] * 10 / $post['marketprice'], 1);
$post['savemoney'] = dround($post['marketprice'] - $post['price']);
$post['fee'] = dround($post['fee']);
$post['price'] = dround($post['price']);
$post['marketprice'] = dround($post['marketprice']);
$post['minamount'] = dround($post['minamount']);
$post['amount'] = dround($post['amount']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($MOD['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($MOD['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($post['content'] && !$post['introduce'] && $post['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $MOD['introduce_length']));
}
if ($this->itemid) {
$new = $post['content'];
if ($post['thumb']) {
$new .= '<img src="' . $post['thumb'] . '"/>';
}
$r = $this->get_one();
$old = $r['content'];
if ($r['thumb']) {
$old .= '<img src="' . $r['thumb'] . '"/>';
}
delete_diff($new, $old);
} else {
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例14: array
$unit = $currency == 'money' ? $DT['money_unit'] : $DT['credit_unit'];
$name = $currency == 'money' ? $DT['money_name'] : $DT['credit_name'];
$member = array();
if (check_group($_groupid, $MOD['group_contact'])) {
if ($fee) {
if ($MG['fee_mode'] && $MOD['fee_mode']) {
$user_status = 3;
} else {
$mid = $moduleid;
if ($_userid) {
if (check_pay($mid, $itemid)) {
$user_status = 3;
} else {
$user_status = 2;
$linkurl = $MOD['linkurl'] . $linkurl;
$fee_back = $currency == 'money' ? dround($fee * intval($MOD['fee_back']) / 100) : ceil($fee * intval($MOD['fee_back']) / 100);
$pay_url = $MODULE[2]['linkurl'] . 'pay.php?mid=' . $mid . '&itemid=' . $itemid . '&username=' . $username . '&fee_back=' . $fee_back . '&fee=' . $fee . '¤cy=' . $currency . '&sign=' . crypt_sign($_username . $mid . $itemid . $username . $fee . $fee_back . $currency . $linkurl . $title) . '&title=' . rawurlencode($title) . '&forward=' . urlencode($linkurl);
}
} else {
$user_status = 0;
}
}
} else {
$user_status = 3;
}
} else {
$user_status = $_userid ? 1 : 0;
}
if ($_username && $_username == $item['username']) {
$user_status = 3;
}
示例15: listpages
$offset = ($page - 1) * $pagesize;
$pages = listpages($CAT, $items, $page, $pagesize);
$tags = array();
if ($items) {
$result = $db->query("SELECT " . $MOD['fields'] . " FROM {$table} WHERE {$condition} ORDER BY " . $MOD['order'] . " LIMIT {$offset},{$pagesize}", $CFG['db_expires'] && $page == 1 ? 'CACHE' : '', $CFG['db_expires']);
while ($r = $db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['editdate'] = timetodate($r['edittime'], 5);
if ($lazy && isset($r['thumb']) && $r['thumb']) {
$r['thumb'] = DT_SKIN . 'image/lazy.gif" original="' . $r['thumb'];
}
$r['alt'] = $r['title'];
$r['title'] = set_style($r['title'], $r['style']);
$r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
$tags[] = $r;
}
$db->free_result($result);
}
$showpage = 1;
$datetype = 5;
$width = 250;
$height = 180;
$cols = 3;
$percent = dround(100 / $cols) . '%';
$seo_file = 'list';
include DT_ROOT . '/include/seo.inc.php';
if ($EXT['wap_enable']) {
$head_mobile = $EXT['wap_url'] . 'index.php?moduleid=' . $moduleid . '&catid=' . $catid . ($page > 1 ? '&page=' . $page : '');
}
$template = $CAT['template'] ? $CAT['template'] : 'list';
include template($template, $module);