本文整理汇总了PHP中ajaxReturn函数的典型用法代码示例。如果您正苦于以下问题:PHP ajaxReturn函数的具体用法?PHP ajaxReturn怎么用?PHP ajaxReturn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ajaxReturn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_acl
/**
* 权限检测
* @author allen caowenpeng1990@126.com
*/
protected function check_acl()
{
$controller = $this->uri->rsegment(1) ? $this->uri->rsegment(1) : getgpc("mod");
$action = $this->uri->rsegment(2) ? $this->uri->rsegment(2) : getgpc("act");
$node_str = $controller . '/' . $action;
$query_node = $this->db->get_where('admin_node', array('node' => $node_str, 'status' => 1));
$node = $query_node->row_array();
//查出被权限的节点
$admin_utype = $this->session->userdata('admin_utype');
if ($admin_utype == 'sysadmin') {
//全站放行
return;
}
if (is_array($node) && count($node) > 0) {
$admin_id = $this->session->userdata('admin_id');
$query_acl = $this->db->select('admin_group.acl')->from('admin_group')->join('admin_user', 'admin_user.groupid = admin_group.id')->where(array('admin_user.id' => $admin_id))->get();
$acl = unserialize($query_acl->row_array()['acl']);
if (!in_array($node['id'], $acl)) {
if ($this->input->is_ajax_request()) {
$data['status'] = false;
$data['msg'] = '您没有权限进行此操作!';
ajaxReturn($data);
} else {
header("Content-type:text/html;charset=utf-8");
alert("您没有权限进行此操作!");
}
}
}
}
示例2: develop_public
/** markdown格式接口 */
public function develop_public()
{
$gData = checkData($_GET);
$int_opt = $gData['int_opt'];
if (!$int_opt) {
ajaxReturn('非法操作[缺少必须参数]', 300);
}
//样式
echo '<style>
.markdown-here-wrapper h1{ font-size: 20px; font-weight:bold; margin-top: 10px;}
.markdown-here-wrapper h2{ font-size: 18px; font-weight:bold; margin-top: 10px;}
.markdown-here-wrapper h3{ font-size: 16px; font-weight:bold; margin-top: 10px;}
.markdown-here-wrapper table{ border-collapse: collapse; border: 1px solid yellowgreen;}
.markdown-here-wrapper th { vertical-align: baseline; border: 1px solid yellowgreen; font-weight:bold; font-size: 18px;}
.markdown-here-wrapper td { vertical-align: middle; border: 1px solid yellowgreen; font-size: 18px;}
.markdown-here-wrapper tr { border: 1px solid yellowgreen;}
.markdown-here-wrapper p a{font-size: 16px;}
</style>';
$output = $text = file_get_contents(MODULE_PATH . 'develop_info/' . $int_opt . '.md');
$parser = new MarkdownExtra();
$my_html = $parser->transform($output);
$this->s->assign('my_html', $my_html);
$this->s->display('interface_admin/interface_list.html');
}
示例3: city
public function city()
{
$id = I('get.provinceid', '', 'intval');
$cval = M('cities')->field('id,city,provinceid,cityid')->where('provinceid=' . $id)->select();
if ($cval === false) {
ajaxReturn(101, '请求失败', '');
} else {
ajaxReturn(0, '', $cval);
}
}
示例4: actorssearch
public function actorssearch()
{
$condition = I('get.condition');
$data['name|achievement'] = array('like', '%' . $condition . '%');
$data['status'] = array(array('eq', 1), array('eq', 2), 'or');
$actors = M('actors');
$actorsval = $actors->where($data)->select();
if ($actorsval === false) {
ajaxReturn(101, '请求失败', '');
} else {
ajaxReturn(0, '', $actorsval);
}
}
示例5: get_menu_c
public function get_menu_c()
{
$pData = checkData($_POST);
$pid = intval($pData['pid']);
if (!$pid) {
$list = "<option value='0'>请选择一个项目</option>";
} else {
$list = "<option value='0'>--请选择栏目--</option>";
$data = $this->getCache('sys_menu');
foreach ($data[$pid]['list'] as $v) {
$list .= "<option value='" . $v['id'] . "'>" . $v['name'] . "(" . $v['action'] . ")</option>";
}
}
ajaxReturn($list, 200);
}
示例6: handleException
public static function handleException($e)
{
$err_code = $e->getCode();
$err_message = $e->getMessage();
$err_file = $e->getFile();
$err_line = $e->getLine();
if (IS_DEBUG) {
self::$_errors[] = '==== handleException ====';
self::$_errors[] = array('code' => $err_code, 'message' => $err_message, 'file' => $err_file, 'line' => $err_line, 'trace' => $e->getTrace());
// Exception 终止运行,故在此输出错误信息
self::showErrors();
} else {
IS_CLI ? print $err_message : (isAjax() ? ajaxReturn(0, '服务器端错误') : redirect(SITE_URI . '/error.html'));
}
// 转换为相对路径,降低log 长度=。=!
$err_file = str_replace(APPLICATION_PATH, '', $err_file);
Core_Log::getInstance()->error("{$err_message} CODE:{$err_code} FILE:{$err_file} LINE:{$err_line}");
}
示例7: uppasswd
public function uppasswd()
{
$oldp = I('post.oldp', '', 'md5');
$data['passwd'] = I('post.newp', '', 'md5');
$admin = M('admin');
$where = array('name' => session('name'), 'passwd' => $oldp);
$adminval = $admin->where($where)->find();
if ($adminval) {
$sign = $admin->where('id=' . $adminval['id'])->save($data);
if ($sign) {
ajaxReturn(0, '修改成功', '');
} else {
ajaxReturn(1, '未修改成功', $admin->getlastsql());
}
} else {
ajaxReturn(102, '旧密码不正确', '');
}
}
示例8: deleteBid
/**
*更新bid
*/
public function deleteBid()
{
$pData = checkData($_REQUEST);
$id = $pData['id'];
if (!$id) {
ajaxReturn('不能为空', 300);
}
$delete_sql = "DELETE FROM waplog.`wap_bid_list` where id={$id}";
if ($this->db->query($delete_sql)) {
ajaxReturn('删除成功', 200);
} else {
ajaxReturn('删除失败', 300);
}
/*
$id = $gData['id'];
$sql = "select * from waplog.`wap_bid_list` WHERE id={$id}";
$data = $this->db->get($sql);
$this->s->assign('result', $data);*/
}
示例9: recommendstar
public function recommendstar()
{
$actors = M('actors');
$where['status'] = array(array('neq', 0), array('neq', 3));
$where['recommend'] = 1;
$count = $actors->where($where)->count();
// 查询满足要求的总记录数
$Page = new \Think\Page($count, 8);
// 实例化分页类 传入总记录数和每页显示的记录数(25)
$show = $Page->show();
// 分页显示输出
// 进行分页数据查询注意limit方法的参数要使用Page类的属性
$list = $actors->field('id,img,name')->where($where)->order('instime desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
$data['page'] = ceil($count / 8);
$data['data'] = $list;
if ($list === false) {
ajaxReturn(101, '请求失败', '');
} else {
ajaxReturn(0, '', $data);
}
}
示例10: system_options_cache
/** 系统缓存设置 */
public function system_options_cache()
{
if ($this->system_options(1, 1)) {
ajaxReturn('缓存系统设置成功', 200);
}
}
示例11: errReturn
function errReturn($errCode, $msg)
{
ajaxReturn($errCode, $msg);
}
示例12: chang_user_pass
/** 修改帐号密码 */
public function chang_user_pass()
{
$pData = checkData($_POST);
$AdminUserTable = $this->OperateTable['AdminUserTable'];
$user_name = $_SESSION['user_id']['user_name'];
$user_id = $_SESSION['user_id']['user_id'];
if ($user_name == 'weedong91admin' || $user_id == 1) {
ajaxReturn('不能修改超级管理员帐号密码', 300);
}
$info_sql = "SELECT user_id,user_pass,user_name FROM {$AdminUserTable} WHERE user_id={$user_id} LIMIT 1";
$infoData = $this->db->get($info_sql);
$uData['user_id'] = $infoData['user_id'];
$uData['user_name'] = $infoData['user_name'];
$uData['user_pass'] = $infoData['user_pass'];
if ($user_name != $uData['user_name'] || $user_id != $uData['user_id']) {
ajaxReturn('非法操作[!!!]', 300);
}
if ($pData) {
/*$old_pass = MD5(MD5($pData['old_pass']));
$user_pass = MD5(MD5($pData['user_pass']));
$auth_pass = MD5(MD5($pData['auth_pass']));*/
$old_pass = MD5($pData['old_pass']);
$user_pass = MD5($pData['user_pass']);
$auth_pass = MD5($pData['auth_pass']);
if ($user_pass != $auth_pass) {
ajaxReturn('两次密码输入不同,请重新输入', 300);
}
if ($old_pass != $uData['user_pass']) {
ajaxReturn('您的旧密码错误,请重新输入', 300);
}
$sql = "UPDATE {$AdminUserTable} SET user_pass='{$user_pass}' WHERE user_id=" . $uData['user_id'] . " AND user_pass='" . $uData['user_pass'] . "' LIMIT 1";
if ($this->db->query($sql)) {
$this->setLog('修改用户密码{' . $user_name . '}成功!');
$back_json = '{
"statusCode":"200",
"message":"修改用户密码{' . $user_name . '}成功!",
"callbackType":"closeCurrent"
}';
echo $back_json;
exit;
} else {
$this->setLog('修改用户密码{' . $user_name . '}失败!');
ajaxReturn('修改用户密码{' . $user_name . '}失败!', 300);
}
}
$this->s->assign('uData', $uData);
$this->s->display('admin/chang_user_pass.html');
}
示例13: foreach
$rack_combo_options[0] = '';
foreach ($racks as $rack) {
$rack_combo_options[$rack['bin_racks_id']] = 'Rack ' . $class_bins->formatRackNumber($rack['no']) . ' (' . $class_bins->rack_flag_options[$rack['rack_flag']] . ')';
}
echo utf8_encode('<select>' . loadComboListFromArray($rack_combo_options) . '</select>');
exit;
} elseif ($_POST['me_action'] == 'LOADBIN') {
$segment_id = tep_db_prepare_input($_POST['segment_id']);
$rack_id = tep_db_prepare_input($_POST['rack_id']);
$bin = $class_bins->getBinUsable($segment_id, null, $rack_id);
if (is_null($bin)) {
$bin = array('error' => '1');
} else {
$bin['error'] = '0';
}
ajaxReturn($bin);
exit;
} elseif ($_POST['me_action'] == "TRANSFERBIN") {
$bin_id_old = tep_db_prepare_input($_POST['bin_id_old']);
$bin_id_new = tep_db_prepare_input($_POST['bin_id_new']);
echo utf8_encode($class_bins->transferBin($bin_id_old, $bin_id_new) ? 'OK' : 'FAILED');
exit;
}
}
$_SESSION[$session_page]['last_scan'] = '';
$_SESSION[$session_page]['last_scan_count'] = 0;
$box_style = 'style="text-align:center;width:500px;padding:20px;"';
$content .= '<div class="red" style="margin-bottom:10px;">* <strong>Bin In</strong> and <strong>Pick and Pack</strong> Process must be closed before starting this process</div>';
//STEP 1
$content .= '<div id="step-1-window" class="box ui-corner-all" ' . $box_style . '>';
$content .= '<h2 style="margin-bottom:20px;" class="notice">Step 1: Choose Original Bin Location</h2>';
示例14: list
$ids = $_POST['ids'];
list($notifications_id, $not_class) = split('-', $ids);
$notifications->delete($notifications_id);
$result = array();
$result['notifications_id'] = $notifications_id;
$result['not_class'] = $not_class;
ajaxReturn($result);
exit;
} elseif ($_POST['me_action'] == 'CLOSEFEEDBACK') {
$ids = $_POST['ids'];
list($notifications_id, $not_class) = split('-', $ids);
$notifications->closeOpenFeedback($notifications_id);
$result = array();
$result['ids'] = $ids;
$result['notifications_id'] = $notifications_id;
ajaxReturn($result);
exit;
} elseif ($_POST['me_action'] == 'REFRESHFILTERS') {
$sender = tep_db_prepare_input($_POST['sender']);
$filter = isset($_POST['sender']) && $_POST['sender'] != '' ? "AND posted_by = '{$sender}'" : "";
}
}
$date_oldest = date('Y-m-d', strtotime("-14 day"));
$date_today = date('j M Y');
$date_yesterday = date('j M Y', strtotime("-1 day"));
$n_lists = $notifications->retrieveListGeneralQuery("muhn.user_id={$session_userinfo['id']} AND (muhn.status=0 OR muhn.need_feedback=1 OR muhn.posted_date>='{$date_oldest}') {$filter}", 'muhn.posted_date DESC, muhn.posted_by');
$notifications_new = array();
$printed_date = '';
$previous_date = '';
//$dbposted = tep_db_query("SELECT DISTINCT posted_by FROM minierp_users_has_notifications WHERE user_id = '$session_userinfo[id]'");
//while($r=tep_db_fetch_array($dbposted))$postedusers[$r['posted_by']] = $r['posted_by'];
示例15: while
$page = $_POST['page'];
$pageSize = $_POST['rows'];
$sort = $_POST['sord'];
$order = $_POST['sidx'];
$offset = ($page - 1) * $pageSize;
//分页起始条数
$sql = "select * from employee order by {$order} {$sort} limit {$offset}, {$pageSize}";
$result = $conn->query($sql);
$rows = [];
if ($result) {
$nums = $result->num_rows;
while ($row = $result->fetch_assoc()) {
$rows[] = $row;
}
}
if ($nums > 0) {
$total_pages = ceil($nums / $pageSize);
} else {
$total_pages = 0;
}
$arr_json = array('page' => $page, 'total' => $total_pages, 'records' => $nums, 'rows' => $rows);
ajaxReturn($arr_json);
/**
*
* @param array $data
*/
function ajaxReturn(array $data)
{
header('content-type:application/json;charset=utf8');
exit(json_encode($data, JSON_UNESCAPED_UNICODE));
}