本文整理汇总了PHP中tablename函数的典型用法代码示例。如果您正苦于以下问题:PHP tablename函数的具体用法?PHP tablename怎么用?PHP tablename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tablename函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: receive
public function receive()
{
global $_W;
$type = $this->message['type'];
//这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码
if ($type != "text" && $type != "image" && $type != "voice") {
return;
}
$file = IA_ROOT . '/source/modules/mechat/function.php';
if (!file_exists($file)) {
return array();
}
include_once $file;
$sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
$row = pdo_fetch($sql, array(':weid' => $_W['weid']));
if ($row) {
$pdata = array("ToUserName" => $this->message['tousername'], "FromUserName" => $this->message['fromusername'], "CreateTime" => $this->message['createtime'], "MsgType" => $this->message['msgtype'], "Content" => $this->message['content'], "MsgId" => $this->message['msgid']);
if ($type == "voice") {
$pdata["MsgType"] = "text";
$pdata["Content"] = "系统:微信公众号粉丝发送语音消息,系统暂不能接收请客服处理。";
}
$dat = array('unit' => $row["name"], 'msg' => json_encode($pdata));
$dat2 = iunserializer($row["cdata"]);
$actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $dat2["access_token"], "appid" => $dat2["appid"], "appsecret" => $dat2["appsecret"]));
$url = sprintf($this->gateway['mechat_receive'], $actoken);
$content = ihttp_post($url, $dat);
}
}
示例2: respond
public function respond()
{
global $_W;
$content = $this->message['content'];
$reply = pdo_fetch('SELECT * FROM ' . tablename('cover_reply') . ' WHERE `rid`=:rid', array(':rid' => $this->rule));
if (!empty($reply)) {
load()->model('module');
$module = module_fetch($reply['module']);
if (empty($module) && !in_array($reply['module'], array('site', 'mc', 'card'))) {
return '';
}
$url = $reply['url'];
if (empty($reply['url'])) {
$entry = pdo_fetch("SELECT eid FROM " . tablename('modules_bindings') . " WHERE module = :module AND do = :do", array(':module' => $reply['module'], ':do' => $reply['do']));
$url = url('entry', array('eid' => $entry['eid']));
}
if (!strexists($url, '&j=') && !empty($_W['acid'])) {
$url = str_replace("?i={$_W['uniacid']}&", "?i={$_W['uniacid']}&j={$_W['acid']}&", $url);
}
$news = array();
$news[] = array('title' => $reply['title'], 'description' => $reply['description'], 'picurl' => $reply['thumb'], 'url' => $url);
return $this->respNews($news);
}
return '';
}
示例3: respond
public function respond()
{
global $_W;
$content = $this->message['content'];
$foods = pdo_fetchall("SELECT * FROM " . tablename('jufeng_wcy_foods') . " WHERE weid = '{$_W['uniacid']}' AND title LIKE '%{$content}%' ");
$pcate = pdo_fetchall("SELECT * FROM " . tablename('jufeng_wcy_category') . " WHERE weid = '{$_W['uniacid']}' AND parentid = '0' AND name LIKE '%{$content}%' ");
$news[] = array('title' => '在线订餐', 'description' => '方便快捷,价格优惠', 'picurl' => '../addons/jufeng_wcy/images/dc.jpg', 'url' => $this->createMobileUrl('dianjia'));
$foodsnum = count($foods);
$pcatenum = count($pcate);
if ($foodsnum == 0 && $pcatenum == 0) {
$news[] = array('title' => '直接回复你想吃的,可搜索菜品和餐馆哦');
$news[] = array('title' => '没有关于【' . $content . '】的菜品或餐馆');
}
if ($pcatenum < 9) {
$printnum = $pcatenum;
} else {
$printnum = 9;
}
for ($i = 0; $i < $printnum; $i++) {
$news[] = array('title' => "【" . $pcate[$i]['name'] . "】——" . "热度:" . $pcate[$i]['total'], 'description' => "", 'picurl' => $_W['attachurl'] . $pcate[$i]['thumb'], 'url' => $this->createMobileUrl('list', array('pcate' => $pcate[$i]['id'])));
}
$printnum = 9 - $printnum;
if ($foodsnum < $printnum) {
$printnum = $foodsnum;
}
for ($i = 0; $i < $printnum; $i++) {
$dianjia = pdo_fetch("SELECT * FROM " . tablename('jufeng_wcy_category') . " WHERE weid = '{$_W['uniacid']}' AND id = '{$foods[$i]['pcate']}'");
$news[] = array('title' => "【" . $foods[$i]['title'] . "】——" . $dianjia['name'], 'description' => "菜品热度:" . $foods[$i]['hits'], 'picurl' => $_W['attachurl'] . $foods[$i]['thumb'], 'url' => $this->createMobileUrl('list', array('pcate' => $foods[$i]['pcate'])));
}
return $this->respNews($news);
}
示例4: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
//要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
global $_W;
$reply = pdo_fetch("SELECT * FROM " . tablename('game2048_reply') . " WHERE rid = :rid", array(':rid' => $rid));
include $this->template('form');
}
示例5: site_category
function site_category($params = array())
{
global $_GPC, $_W;
extract($params);
if (!isset($parentid)) {
$condition = "";
} else {
$condition = " AND parentid = '{$parentid}'";
}
$category = array();
$result = pdo_fetchall("SELECT * FROM " . tablename('article_category') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY parentid ASC, displayorder ASC, id ASC ");
if (!isset($parentid)) {
if (!empty($result)) {
foreach ($result as $row) {
if (empty($row['parentid'])) {
$category[$row['id']] = $row;
} else {
$category[$row['parentid']]['children'][$row['id']] = $row;
}
}
}
} else {
$category = $result;
}
return $category;
}
示例6: respond
public function respond() {
global $_W;
$rid = $this->rule;
$sql = "SELECT id FROM " . tablename('news_reply') . " WHERE `rid`=:rid AND parentid = 0 ORDER BY RAND()";
$main = pdo_fetch($sql, array(':rid' => $rid));
if (empty($main['id'])) {
return array();
}
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE id = :id OR parentid = :parentid ORDER BY parentid ASC, id ASC LIMIT 8";
$commends = pdo_fetchall($sql, array(':id'=>$main['id'], ':parentid'=>$main['id']));
$news = array();
foreach($commends as $c) {
$row = array();
$row['title'] = $c['title'];
$row['description'] = $c['description'];
!empty($c['thumb']) && $row['picurl'] = $_W['attachurl'] . trim($c['thumb'], '/');
$row['url'] = empty($c['url']) ? $_W['siteroot'] . create_url('index/module', array('do' => 'detail', 'name' => 'news', 'id' => $c['id'])) : $c['url'];
$news[] = $row;
}
$r['FromUserName'] = $this->message['to'];
$r['ToUserName'] = $this->message['from'];
$r['MsgType'] = 'news';
$r['ArticleCount'] = count($news);
$r['Articles'] = array();
foreach ($news as $row) {
$r['Articles'][] = array(
'Title' => $row['title'],
'Description' => $row['description'],
'PicUrl' => $row['picurl'],
'Url' => $row['url'],
'TagName' => 'item',
);
}
return $r;
}
示例7: site_article
function site_article($params = array())
{
global $_GPC, $_W;
extract($params);
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$result = array();
$condition = " WHERE weid = '{$_W['weid']}'";
if (!empty($cid)) {
$category = pdo_fetch("SELECT parentid FROM " . tablename('category') . " WHERE id = '{$cid}'");
if (!empty($category['parentid'])) {
$condition .= " AND ccate = '{$cid}'";
} else {
$condition .= " AND pcate = '{$cid}'";
}
}
if ($iscommend == 'true') {
$condition .= " AND iscommend = '1'";
}
if ($ishot == 'true') {
$condition .= " AND ishot = '1'";
}
$sql = "SELECT * FROM " . tablename('article') . $condition . ' ORDER BY displayorder DESC, id DESC';
$result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('article') . $condition);
$result['pager'] = pagination($total, $pindex, $psize);
if (!empty($result['list'])) {
foreach ($result['list'] as &$row) {
$row['url'] = create_url('mobile/module/hdetail', array('name' => 'shouse', 'id' => $row['id'], 'weid' => $_W['weid']));
}
}
return $result;
}
示例8: getMember
private function getMember()
{
global $_W;
$sql = 'SELECT `lastupdate`, `isblacklist`, `rid` FROM ' . tablename('wxwall_members') . ' WHERE `from_user` =
:from_user AND `rid` = :rid';
$params = array(':from_user' => $_W['openid'], ':rid' => $this->rule);
$member = pdo_fetch($sql, $params);
// 获取粉丝头像
$account = WeAccount::create($_W['acid']);
$fansInfo = $account->fansQueryInfo($_W['openid']);
if (empty($member)) {
$member = array('from_user' => $_W['openid'], 'rid' => $this->rule, 'isjoin' => 1, 'lastupdate' => TIMESTAMP, 'isblacklist' => 0);
if (!is_error($fansInfo)) {
$member['avatar'] = rtrim($fansInfo['headimgurl'], '0') . '132';
}
pdo_insert('wxwall_members', $member);
} else {
if (!is_error($fansInfo)) {
$member['avatar'] = rtrim($fansInfo['headimgurl'], '0') . '132';
}
$member['lastupdate'] = TIMESTAMP;
$params = array('from_user' => $_W['openid'], 'rid' => $this->rule);
pdo_update('wxwall_members', $member, $params);
}
return $member;
}
示例9: respond
public function respond()
{
global $_W;
$content = $this->message['content'];
//这里定义此模块进行消息处理时的具体过程, 请查看WORMWOOD文档来编写你的代码
$isfill = pdo_fetchcolumn("SELECT isfill FROM " . tablename('feng_testingreply') . " WHERE rid =:rid AND testingid = '0'", array(':rid' => $this->rule));
$reply = pdo_fetchall("SELECT * FROM " . tablename('feng_testingreply') . " WHERE rid = :rid", array(':rid' => $this->rule));
if (!empty($reply)) {
foreach ($reply as $row) {
$ids[$row['testingid']] = $row['testingid'];
}
$article = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE id IN (" . implode(',', $ids) . ")", array(), 'id');
}
if ($isfill && ($count = 8 - count($reply)) > 0) {
$articlefill = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE weid = '{$_W['weid']}' AND id NOT IN (" . implode(',', $ids) . ") ORDER BY id DESC LIMIT {$count}", array(), 'id');
if (!empty($articlefill)) {
foreach ($articlefill as $row) {
$article[$row['id']] = $row;
$reply[]['testingid'] = $row['id'];
}
unset($articlefill);
}
}
if (!empty($reply)) {
$response = array();
foreach ($reply as $row) {
$row = $article[$row['testingid']];
if (!empty($row)) {
$response[] = array('title' => $row['title'], 'description' => $row['description'], 'picurl' => $row['thumb'], 'url' => $this->buildSiteUrl($this->createMobileUrl('detail', array('id' => $row['id']))));
}
}
}
return $this->respNews($response);
}
示例10: __buildSiteUrl
function __buildSiteUrl($url)
{
global $_W, $engine;
$mapping = array('[from]' => $engine->message['from'], '[to]' => $engine->message['to'], '[uniacid]' => $_W['uniacid']);
$url = str_replace(array_keys($mapping), array_values($mapping), $url);
$pass = array();
$pass['openid'] = $engine->message['from'];
$pass['acid'] = $_W['acid'];
$sql = 'SELECT `fanid`,`salt`,`uid` FROM ' . tablename('mc_mapping_fans') . ' WHERE `acid`=:acid AND `openid`=:openid';
$params = array();
$params[':acid'] = $_W['acid'];
$params[':openid'] = $pass['openid'];
$fan = pdo_fetch($sql, $params);
if (empty($fan) || !is_array($fan) || empty($fan['salt'])) {
$fan = array('salt' => '');
}
$pass['time'] = TIMESTAMP;
$pass['hash'] = md5("{$pass['openid']}{$pass['time']}{$fan['salt']}{$_W['config']['setting']['authkey']}");
$auth = base64_encode(json_encode($pass));
$vars = array();
$vars['uniacid'] = $_W['uniacid'];
$vars['__auth'] = $auth;
$vars['forward'] = base64_encode($url);
return $_W['siteroot'] . 'app/' . url('auth/forward', $vars);
}
示例11: fieldsFormSubmit
public function fieldsFormSubmit($rid)
{
//规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
global $_GPC, $_W;
$currentprompt = trim($_GPC['currentprompt']) ? trim($_GPC['currentprompt']) : '当前数字是 {LUCKYNUM}!';
$awardprompt = trim($_GPC['awardprompt']) ? trim($_GPC['awardprompt']) : '恭喜您,当前数字是 {LUCKYNUM},获得 {AWARD} 奖品!';
$data = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'luckynumstart' => $_GPC['luckynumstart'], 'luckynumfilter' => $_GPC['luckynumfilter'], 'show_instruction' => $_GPC['show_instruction'], 'time_instruction' => $_GPC['time_instruction'], 'limit_instruction' => $_GPC['limit_instruction'], 'end_instruction' => $_GPC['end_instruction'], 'awardnum_instruction' => $_GPC['awardnum_instruction'], 'award_instruction' => $_GPC['award_instruction'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'limittype' => $_GPC['limittype'], 'awardnum' => $_GPC['awardnum'], 'ticketinfo' => $_GPC['ticketinfo'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'currentprompt' => $currentprompt, 'awardprompt' => $awardprompt, 'sponsors1' => $_GPC['sponsors1'], 'sponsors1link' => $_GPC['sponsors1link'], 'sponsors2' => $_GPC['sponsors2'], 'sponsors2link' => $_GPC['sponsors2link'], 'sponsors3' => $_GPC['sponsors3'], 'sponsors3link' => $_GPC['sponsors3link'], 'sponsors4' => $_GPC['sponsors4'], 'sponsors4link' => $_GPC['sponsors4link'], 'sponsors5' => $_GPC['sponsors5'], 'sponsors5link' => $_GPC['sponsors5link'], 'ruletext' => $_GPC['ruletext'], 'title' => $_GPC['title'], 'shareimg' => $_GPC['shareimg'], 'sharetitle' => $_GPC['sharetitle'], 'sharedesc' => $_GPC['sharedesc']);
$id = pdo_fetchcolumn("SELECT id FROM " . tablename('stonefish_luckynum') . " WHERE rid = :rid", array(':rid' => $rid));
//if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
if (empty($id)) {
$data['isshow'] = 1;
pdo_insert('stonefish_luckynum', $data);
} else {
pdo_update('stonefish_luckynum', $data, array('id' => $id));
}
//}
//update
if (!empty($_GPC['award_number'])) {
foreach ($_GPC['award_number'] as $key => $val) {
$update_data = array('numbers' => $_GPC['award_number'][$key], 'title' => $_GPC['award_title'][$key], 'description' => $_GPC['award_desc'][$key]);
//if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
pdo_update($this->tablename, $update_data, array('id' => $key));
//}
}
}
//insert
if (!empty($_GPC['newaward_number'])) {
foreach ($_GPC['newaward_number'] as $key => $val) {
$new_data = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'numbers' => $_GPC['newaward_number'][$key], 'title' => $_GPC['newaward_title'][$key], 'description' => $_GPC['newaward_desc'][$key], 'dateline' => $_W['timestamp']);
//if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
pdo_insert($this->tablename, $new_data);
//}
}
}
}
示例12: reply_kaquanDetail
private function reply_kaquanDetail($card_id)
{
$sql = "SELECT card_detail FROM " . tablename($this->tb_cards) . " WHERE card_id = :card_id";
$param[':card_id'] = $card_id;
$card_detail = pdo_fetch($sql, $param);
return $card_detail['card_detail'];
}
示例13: fieldsFormSubmit
public function fieldsFormSubmit($rid)
{
global $_GPC, $_W;
$id = intval($_GPC['reply_id']);
$insert = array('rid' => $rid, 'weid' => $this->weid, 'title' => $_GPC['title'], 'kptime' => strtotime($_GPC['kptime']), 'rztime' => strtotime($_GPC['rztime']), 'kfs' => $_GPC['kfs'], 'price' => $_GPC['price'], 'lpaddress' => $_GPC['lpaddress'], 'sltel' => $_GPC['sltel'], 'zxtel' => $_GPC['zxtel'], 'news_title' => $_GPC['news_title'], 'news_icon' => $_GPC['news_icon'], 'news_content' => $_GPC['news_content'], 'share_title' => $_GPC['share_title'], 'share_icon' => $_GPC['share_icon'], 'share_content' => $_GPC['share_content'], 'order_title' => $_GPC['order_title'], 'order_remark' => $_GPC['order_remark'], 'cover_img' => $_GPC['cover_img'], 'overview_img' => $_GPC['overview_img'], 'intro_img' => $_GPC['intro_img'], 'dt_img' => $_GPC['dt_img'], 'dt_intro' => htmlspecialchars_decode($_GPC['dt_intro']), 'intro' => htmlspecialchars_decode($_GPC['intro']), 'createtime' => TIMESTAMP);
if (empty($id)) {
$id = pdo_insert($this->table_hosue, $insert);
} else {
pdo_update($this->table_hosue, $insert, array('id' => $id));
}
///说明项处理
$house_ids = $_GPC['house_ids'];
$house_names = $_GPC['house_iname'];
$house_conents = $_GPC['house_icontent'];
$house_sorts = $_GPC['house_sort'];
pdo_query("delete from " . tablename($this->table_house_item) . " where hid=:hid", array(":hid" => $id));
if (is_array($house_ids)) {
foreach ($house_ids as $key => $value) {
$value = intval($value);
$d = array("rid" => $rid, "hid" => $id, "iname" => $house_names[$key], "icontent" => $house_conents[$key], "sort" => $house_sorts[$key]);
pdo_insert($this->table_house_item, $d);
}
}
return true;
}
示例14: respond
public function respond()
{
global $_W;
load()->func('compat.biz');
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename('bm_top_reply') . " WHERE `rid`=:rid LIMIT 1";
$row = pdo_fetch($sql, array(':rid' => $rid));
if (empty($row['id'])) {
return $this->respText("系统升级中,请稍候!");
}
$desc = $row['desc'];
//描述
$n = $row['n'];
//粉丝基数
$fromuser = $this->message['from'];
$num = mc_fansinfo($fromuser);
$numx = $n + $num['fanid'];
$name = $_W['account']['name'];
//公众号名称
$str = str_replace('{name}', $name, $desc);
$str = str_replace('{numx}', $numx, $str);
if ($row['pictype'] == 1) {
//$str = "嗨,欢迎关注【".$name."】,您是第".$numx."位关注人!\n".$desc."\n <a href='".$url."'>".$urltext."</a>";
return $this->respText($str);
} else {
$response['FromUserName'] = $this->message['to'];
$response['ToUserName'] = $this->message['from'];
$response['MsgType'] = 'news';
$response['ArticleCount'] = 1;
$response['Articles'] = array();
$response['Articles'][] = array('Title' => $row['title'], 'Description' => $str, 'PicUrl' => !strexists($row['picurl'], 'http://') ? $_W['attachurl'] . $row['picurl'] : $row['picurl'], 'Url' => $row['urlx'], 'TagName' => 'item');
return $response;
}
}
示例15: getCategory
public function getCategory()
{
global $_W;
$shopset = m('common')->getSysset('shop');
$allcategory = array();
$category = pdo_fetchall("SELECT * FROM " . tablename('ewei_shop_category') . " WHERE uniacid=:uniacid and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(':uniacid' => $_W['uniacid']));
$category = set_medias($category, array('thumb', 'advimg'));
foreach ($category as $c) {
if (empty($c['parentid'])) {
$children = array();
foreach ($category as $c1) {
if ($c1['parentid'] == $c['id']) {
if (intval($shopset['catlevel']) == 3) {
$children2 = array();
foreach ($category as $c2) {
if ($c2['parentid'] == $c1['id']) {
$children2[] = $c2;
}
}
$c1['children'] = $children2;
}
$children[] = $c1;
}
}
$c['children'] = $children;
$allcategory[] = $c;
}
}
return $allcategory;
}