本文整理汇总了PHP中method_is函数的典型用法代码示例。如果您正苦于以下问题:PHP method_is函数的具体用法?PHP method_is怎么用?PHP method_is使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了method_is函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_login
<?php
include_once "../../../includes/config.inc.php";
check_login();
//验证是否登录
$model = new Model_ApplistHptShopGoods();
$cateModel = new Model_ApplistHptShopCate();
$smarty->assign('cateName', '商品');
//数据保存
if ($_REQUEST['a'] == 'add') {
//$tagModel=new Model_ApplistHptShopTag();
if (method_is('post')) {
$data = $_POST;
$res = $model->add($data);
echo json_encode('success');
die;
} else {
$id = (int) $_GET['id'];
if ($id) {
$smarty->assign('vo', $model->find($id));
}
//获取商品类别
$smarty->assign('cateList', $cateModel->findAll(" id>0 "));
/* //获取商品标签
$smarty->assign('tagList',$tagModel->findAll(" gid=$id ")); */
$smarty->setTpl('app/hptshop/templates/goods_add.html')->display();
die;
}
}
//数据删除
if ($_REQUEST['a'] == 'del') {
示例2: Model_Member
<?php
include_once "../../includes/config.inc.php";
include_once "../../includes/login_check.php";
$memberModel = new Model_Member();
//var
$customer_id = (int) $_SESSION['customer_id'];
$status = isset($_REQUEST['status']) ? (int) $_REQUEST['status'] : 1;
$have_cent = isset($_REQUEST['have_cent']) ? (int) $_REQUEST['have_cent'] : 1;
$page = (int) $_REQUEST["p"] > 0 ? (int) $_REQUEST["p"] : 1;
if (method_is('post') && $_POST['act'] == 'upda') {
$have_cent = (int) $_POST['have_cent'];
$id = (int) $_POST['id'];
$memberModel->query("update member set have_cent='{$have_cent}' where customer_id='{$customer_id}' and id='{$id}'");
echo $have_cent;
die;
}
//sql
$filter = array();
$filter['where'] = "customer_id = {$customer_id}";
$filter['order'] = "id desc";
$filter['order'] .= $status ? ',status asc' : ',status desc';
if ($have_cent) {
$filter['order'] .= ',have_cent desc';
}
//result
$result = $memberModel->paginate($filter, '*', $page, 10);
$pager = $result['pager'];
//pager
if ($pager['count'] > $pager['size']) {
$pagerhtml = new SubPages($pager['size'], $pager['count'], $pager['current'], $pager['range'], 2, '');
示例3: Model_InfoCate
<?php
include_once "../../includes/config.inc.php";
include_once "../../includes/login_check.php";
$customer_id = (int) $_SESSION['customer_id'];
$infoModel = new Model_InfoCate();
if (method_is('post') && $_POST['cate_name_two']) {
$cate_name = str_inmysql($_POST['cate_name_two']);
$id = (int) $_POST['id'];
$infoModel->query("update info_cate set cate_name='{$cate_name}' where id='{$id}' and customer_id='{$customer_id}'");
echo "success";
die;
}
if (method_is('post') && $_POST['del_id']) {
$id = (int) $_POST['del_id'];
$infoModel->delete("id='{$id}' and customer_id='{$customer_id}'");
echo "success";
die;
}
$type = $_POST['info_type'];
$data['info_type'] = str_inmysql($_POST['info_type']);
$data['customer_id'] = $customer_id;
$data['cate_name'] = $_POST['cate_name'];
$filter['where'] = "info_type='{$data['info_type']}' and customer_id='{$customer_id}' and cate_name='{$data['cate_name']}'";
$nums = $infoModel->count($filter);
if ($nums > 0) {
echo '1';
die;
}
$num = $infoModel->insert($data);
if ($num > 0) {
示例4: isset
$data['reply_list'] = isset($_POST['reply_list']) ? str_inmysql($_POST['reply_list']) : '';
$sqlStatus = Model_Table::get('Message')->updateById($id, $data);
ajax_feedback(1, array('is_reply_str' => Model_Table::get('Message')->is_reply(1)));
}
//sql
$filter = array();
$now_time = time();
$n_time = $now_time - 48 * 3600;
$filter['where'] = "customer_id = '{$customer_id}' and create_time > '{$n_time}' and fromuser !=''";
$filter['order'] = "id desc";
//$filter['order'] .= $status ? ',status asc' : ',status desc';
if ($_POST['search']) {
$sea = str_inmysql($_POST['search']);
$filter['where'] = "customer_id = '{$customer_id}' and msg_content like '%{$sea}%' and fromuser !=''";
//如果是ajax请求48小时外信息
} elseif (method_is('get') && $_GET['act'] == 'history') {
$filter['where'] = "customer_id = '{$customer_id}' and create_time < '{$n_time}' and fromuser!=''";
//smarty
$smarty->assign("val", true);
}
//result
$msgModel = new Model_Message();
$result = $msgModel->paginate($filter, '*', $page);
$pager = $result['pager'];
//var_dump($_SESSION['customer_id']);die();
//pager
if ($pager['count'] > $pager['size']) {
$pagerhtml = new SubPages($pager['size'], $pager['count'], $pager['current'], $pager['range'], 2, '');
$smarty->assign("pagerhtml", $pagerhtml);
}
foreach ($result['data'] as $key => $row) {