当前位置: 首页>>代码示例>>PHP>>正文


PHP M函数代码示例

本文整理汇总了PHP中M函数的典型用法代码示例。如果您正苦于以下问题:PHP M函数的具体用法?PHP M怎么用?PHP M使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了M函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initGuid

function initGuid()
{
    global $TABLE;
    M('Db')->exec('DROP TABLE IF EXISTS rm_guid');
    M('Db')->exec('CREATE TABLE rm_guid(id INT, type INT);');
    M('Db')->exec("INSERT INTO rm_guid(id,type) VALUES (1,?)", G($TABLE));
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:base.php

示例2: login

 /**
  * 登陆,如果失败,返回失败原因(用户名或者密码不正确),如果成功,返回用户信息,
  * 附带返回系统服务器时间戳
  */
 public function login()
 {
     //查user表
     $User = M('User');
     check_error($User);
     $user = $User->field(array('id' => 'userId', 'username' => 'userName', 'name', 'role_id' => 'roleId', 'role'))->where(array('username' => safe_post_param('username'), '_string' => "`password`=MD5('" . safe_post_param('password') . "')"))->find();
     if (!empty($user)) {
         //根据权限查菜单
         $Menu = M('Menu');
         check_error($Menu);
         $menu = $Menu->join('`role_privilege` on `menu`.`id`=`role_privilege`.`menu_id`')->join('`user` on `user`.`role_id`=`role_privilege`.`role_id`')->field(array('`menu`.`id`', 'level', 'label', 'icon', 'widget', 'show', 'big_icon'))->where("`user`.`id`='" . $user['userId'] . "'")->order('`level` ASC')->select();
         check_error($Menu);
         //保存session
         session('logined', true);
         session('user', $user);
         session('menu', $menu);
         //设置返回数据
         $data = array();
         $data['serverTime'] = time();
         $data['user'] = $user;
         $data['menu'] = $menu;
         //保存日志
         R('Log/adduserlog', array('登录', '登录成功', '成功'));
         //返回结果:用户数据+服务器时间
         return_value_json(true, 'data', $data);
     } else {
         //保存日志
         R('Log/adduserlog', array('登录', '登录失败:用户名或者密码不正确', '失败:权限不够', '用户名:' . safe_post_param('username')));
         return_value_json(false, 'msg', '用户名或者密码不正确');
     }
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:35,代码来源:AuthenticateAction.class.php

示例3: index

 public function index()
 {
     $jobtitle = M('jobtitle');
     $list = $jobtitle->find('1');
     $this->assign('list', $list);
     $this->display();
 }
开发者ID:sunyang3721,项目名称:tjd-timehr,代码行数:7,代码来源:UrlAction.class.php

示例4: index

 function index()
 {
     $db = M('Micrstore_reply');
     $where = array('token' => $this->token);
     $items = $db->where($where)->find();
     return array('name' => '微店', 'subkeywords' => 0, 'sublinks' => 0, 'link' => '{siteUrl}/index.php?g=Wap&m=Micrstore&a=api&store_id=' . $items['sid'] . '&token=' . $this->token . '&wecha_id={wechat_id}', 'keyword' => $items['keyword']);
 }
开发者ID:hehekeke,项目名称:pigcms,代码行数:7,代码来源:FunctionLibrary_Micrstore.class.php

示例5: lists

 public function lists($model = null, $page = 0, $templateFile = '', $order = 'id desc')
 {
     $isAjax = I('isAjax');
     $isRadio = I('isRadio');
     // 获取模型信息
     is_array($model) || ($model = $this->getModel($model));
     $list_data = $this->_get_model_list($model, $page, $order);
     if (!empty($list_data['list_data'])) {
         $coupon_ids = array_unique(getSubByKey($list_data['list_data'], 'coupon_id'));
         $map['id'] = array('in', $coupon_ids);
         $list = M('coupon')->where($map)->field('id,title')->select();
         $couponArr = makeKeyVal($list);
         foreach ($list_data['list_data'] as &$v) {
             $v['coupon_name'] = $couponArr[$v['coupon_id']];
         }
     }
     if ($isAjax) {
         $this->assign('isRadio', $isRadio);
         $this->assign($list_data);
         $this->display('ajax_lists_data');
     } else {
         $this->assign($list_data);
         $templateFile || ($templateFile = $model['template_list'] ? $model['template_list'] : '');
         $this->display($templateFile);
     }
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:26,代码来源:InviteController.class.php

示例6: index

 public function index()
 {
     $id = I('id', '', 'htmlspecialchars');
     $my_id = session('user_id');
     // 只能通过get id才能访问
     if (empty($id)) {
         $this->error('页面不存在!', '/index');
         die;
     }
     $atten = M()->query("select count(*) from dm_items_support where user_id = {$id} and attention=1");
     //关注的人数
     $frien = M()->query("select count(*) from dm_person_friends where user_id = {$id}  ");
     //好友数
     $topic = M()->query("select count(*) from dm_community_comments_first where user_id = {$id} ");
     //帖子数
     $userinfo = M()->query("select * from dm_user_info where id = {$id}");
     if (empty($userinfo[0])) {
         $this->error('不存在该用户', '/index');
         die;
     }
     $usernews = M()->query("select * from dm_community_comments_first where user_id = {$id}");
     foreach ($usernews as $key => $value) {
         $usernews[$key]['time'] = date('n\\月j\\日 G:i', $value['time']);
     }
     $this->assign('atten', $atten);
     $this->assign('frien', $frien);
     $this->assign('topic', $topic);
     $this->assign('add_id', $id);
     // $this->assign('my_id',$id);
     $this->assign('userinfo', $userinfo);
     $this->assign('usernews', $usernews);
     $this->display();
 }
开发者ID:CreateBigChange,项目名称:daymeng,代码行数:33,代码来源:PersonAction.class.php

示例7: edit

 public function edit()
 {
     $id = $this->_get('id', 'intval');
     $info = M('Jianshensub')->find($id);
     $this->assign('info', $info);
     $this->display();
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:7,代码来源:JianshensubAction.class.php

示例8: getGidByNode

 /**
  * 获取某个节点权限的用户组
  *
  * @param unknown_type $node 节点
  * @return unknown $gid 用户组ID
  */
 public function getGidByNode($node)
 {
     if (($cache = F('Cache_Node')) === false) {
         $prefix = C('DB_PREFIX');
         $sql = "select  a.*,b.user_group_id from {$prefix}node a left join {$prefix}user_group_popedom b on  a.node_id = b.node_id";
         $cache = M('')->query($sql);
         F('Cache_Node', $cache);
     }
     $gid = array();
     foreach ($cache as $v) {
         if (empty($v['user_group_id'])) {
             continue;
         }
         if ($v['app_name'] == $node[0]) {
             if ($v['mod_name'] == '*') {
                 $gid[] = $v['user_group_id'];
                 continue;
             }
             if ($v['mod_name'] == $node[1]) {
                 if ($v['act_name'] == $node[2] || $v['act_name'] == '*') {
                     $gid[] = $v['user_group_id'];
                 }
             }
         }
     }
     return $gid;
 }
开发者ID:naliduo,项目名称:ThinkSNS,代码行数:33,代码来源:SystemPopedomModel.class.php

示例9: index

 public function index()
 {
     $sysinfo = M('sys')->order('id asc')->find();
     $this->assign('sys', $sysinfo);
     $appid = $sysinfo['web_appid'];
     $appsecret = $sysinfo['web_appsecret'];
     if (!defined('VIRIFY')) {
         virifylocal();
     }
     $_scene = M('scene');
     $where['scenecode_varchar'] = I('get.id', 0);
     $where['delete_int'] = 0;
     $_scene_list = $_scene->where($where)->select();
     // print_r($_scene_list); exit('dddd');
     $sysinfo = M('sys')->order('id asc')->find();
     if ($sysinfo['is_user_anli_shenghe'] && !isset($_GET['preview'])) {
         if ($_scene_list[0]["shenhe"] != 1) {
             $this->error('抱歉,您的场景还没通过管理员审核', '/#/main');
         }
     }
     $argu2 = array();
     $argu2['title'] = $_scene_list[0]["scenename_varchar"];
     $argu2['url'] = C('IS_OPEN_STATIC') ? 'v-' . $_scene_list[0]["scenecode_varchar"] : 'index.php?c=view&id=' . $_scene_list[0]["scenecode_varchar"];
     $argu2['desc'] = $_scene_list[0]["desc_varchar"];
     $argu2['imgsrc'] = $_scene_list[0]["thumbnail_varchar"];
     $this->assign("confinfo2", $argu2);
     $mydd = get_client_ip();
     if ($mydd !== '127.0.0.1') {
         $confinfo = $this->get_js_sdk($appid, $appsecret);
     }
     $this->assign("confinfo", $confinfo);
     $this->display(HTML_VESION);
 }
开发者ID:sdgdsffdsfff,项目名称:html5Editor,代码行数:33,代码来源:ViewController.class.php

示例10: index

 public function index()
 {
     if (empty($_SESSION['aid'])) {
         $this->redirect('Login/login');
     }
     $news = M('news');
     $info = array('PCTYPE' => PHP_OS, 'RUNTYPE' => $_SERVER["SERVER_SOFTWARE"], 'ONLOAD' => ini_get('upload_max_filesize'), 'ThinkPHPTYE' => THINK_VERSION);
     $start = strtotime(date('Y-m-01 00:00:00'));
     $end = strtotime(date('Y-m-d H:i:s'));
     $data['news_time'] = array('between', array($start, $end));
     $news_list = $news->where($data)->order('news_hits desc')->limit(0, 8)->select();
     //热门文章排行
     $news_count = $news->count();
     //总文章数
     $this->assign('news_count', $news_count);
     $today = strtotime(date('Y-m-d 00:00:00'));
     //今天开始日期
     $todata['news_time'] = array('egt', $today);
     $tonews_count = $news->where($todata)->count();
     //今日发表文章数
     $this->assign('tonews_count', $tonews_count);
     $ztday = strtotime(date('Y-m-d 00:00:00')) - 60 * 60 * 24;
     //昨天开始日期
     $ztdata['news_time'] = array('between', array($ztday, $today));
     $ztnews_count = $news->where($ztdata)->count();
     //总文章数
     $this->assign('ztnews_count', $ztnews_count);
     $difday = ($tonews_count - $ztnews_count) / $ztnews_count * 100;
     //今日与昨日的差
     $this->assign('difday', $difday);
     $this->assign('info', $info);
     $this->assign('news_list', $news_list);
     $this->display();
 }
开发者ID:LiJiaDongYue,项目名称:adminmanage,代码行数:34,代码来源:IndexController.class.php

示例11: index

 public function index()
 {
     if (!session('openid_' . $this->token)) {
         $this->info = M('wxuser')->where(array('token' => $this->token))->find();
         vendor("Oauth2.OAuth2", LIB_PATH . '../Extend/Vendor');
         vendor("Oauth2.Provider.Wechat", LIB_PATH . '../Extend/Vendor');
         $wechat = new Wechat();
         $wechat->config(array('id' => $this->info['appid'], 'secret' => $this->info['appsecret']));
         $redirect_uri = C('site_url') . '/index.php/Wap/Coupons/index?token=' . $this->token . '&coupon_id=' . $this->coupon_id;
         if (!$_GET['code']) {
             // By sending no options it'll come back here
             $url = $wechat->authorize(array('redirect_uri' => $redirect_uri));
             redirect($url);
         } else {
             try {
                 // Have a go at creating an access token from the code
                 $token = $wechat->access($_GET['code'], array('redirect_uri' => $redirect_uri));
                 // Use this object to try and get some user details (username, full name, etc)
                 $user = $wechat->get_user_info($token);
                 $this->openid = $user->openid;
                 session('openid_' . $this->token, $user->openid);
             } catch (OAuth2_Exception $e) {
                 print_r($e);
                 die;
             }
         }
     } else {
         $this->openid = session('openid_' . $this->token);
     }
     $url = C('site_url') . "/index.php?g=Wap&m=Coupon&a=index&type=1&token=" . $this->token . '&id=' . $this->coupon_id . '&wecha_id=' . $this->openid;
     header('Location:' . $url);
 }
开发者ID:zhaoshengloveqingqing,项目名称:Wechat,代码行数:32,代码来源:CouponsAction.class.php

示例12: login

 public function login($username = null, $password = null, $verify = null)
 {
     if (IS_POST) {
         $db = M('user');
         $map['name'] = $username;
         $map['password'] = md5($password);
         $userInfo = $db->where($map)->find();
         if (!$userInfo) {
             $this->error('帐号不存在或被禁用');
         }
         $_SESSION['userid'] = $userInfo['id'];
         $_SESSION['username'] = $userInfo['name'];
         $_SESSION['truename'] = $userInfo['name'];
         $_SESSION['usertype'] = $userInfo['usertype'];
         $_SESSION['studentid'] = $userInfo['studentid'];
         $this->success('登录成功!', U('Index/index'));
         return;
     } else {
         if (is_login()) {
             $this->display('Project/projectList');
             return;
         } else {
             $this->display('User/login');
         }
     }
 }
开发者ID:puppylsy,项目名称:ncics,代码行数:26,代码来源:PublicController.class.php

示例13: index

	function index(){
		if (!$this->sub){
			return array(
			'name'=>'微排号',
			'subkeywords'=>1,
			'sublinks'=>1,
			);
		}else {
			$db		= M('numqueue_action');
			$where	=array('token'=>$this->token);
			$items 	= $db->where($where)->order('id DESC')->select();

			$arr=array(
			'name'=>'微排号',
			'subkeywords'=>array(
			),
			'sublinks'=>array(
			),
			);
			if ($items){
				foreach ($items as $v){
					$arr['subkeywords'][$v['id']]=array('name'=>$v['reply_title'],'keyword'=>$v['reply_keyword']);
					$arr['sublinks'][$v['id']]=array('name'=>$v['reply_title'],'link'=>'{siteUrl}/index.php?g=Wap&m=Numqueue&a=index&token='.$this->token.'&wecha_id={wechat_id}&id='.$v['id']);
				}
			}
			return $arr;	
		}
	}
开发者ID:kevicki,项目名称:pig,代码行数:28,代码来源:FunctionLibrary_Numqueue.class.php

示例14: sort

 /**
 +----------------------------------------------------------
 * 默认排序操作
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public function sort()
 {
     $node = M('HomeNode');
     if (!empty($_GET['sortId'])) {
         $map = array();
         $map['status'] = 1;
         $map['id'] = array('in', $_GET['sortId']);
         $sortList = $node->where($map)->order('sort asc')->select();
     } else {
         if (!empty($_GET['pid'])) {
             $pid = $_GET['pid'];
         } else {
             $pid = $_SESSION['currentNodeId'];
         }
         if ($node->getById($pid)) {
             $level = $node->level + 1;
         } else {
             $level = 1;
         }
         $this->assign('level', $level);
         $sortList = $node->where('status=1 and pid=' . $pid . ' and level=' . $level)->order('sort asc')->select();
     }
     $this->assign("sortList", $sortList);
     $this->display();
     return;
 }
开发者ID:diycp,项目名称:stusys,代码行数:35,代码来源:HomeNodeAction.class.php

示例15: index

 public function index()
 {
     header("content-type:text/html;charset=utf-8");
     // if($_SESSION['phone']){
     // 	$Model
     // 	$where['phone'] = $_SESSION['phone'];
     // 	$this -> redirect('Act/index?phone='.$_SESSION['phone']);
     // 	exit;
     // }
     if (!empty($_POST)) {
         $user_model = M('user');
         // $where['name'] = $_POST['admin'];
         $where['phone'] = $_POST['phone'];
         $res = $user_model->where($where)->find();
         if ($res) {
             //echo $_SESSION['userId'];exit;
             $_SESSION['userId'] = $res['id'];
             //echo $_SESSION['userId1'];exit;
             if ($_SESSION['userId1'] != "") {
                 $aaa = $_SESSION['userId1'];
                 unset($_SESSION['userId1']);
                 echo "<script type='text/javascript'>alert('登录成功');location='/index.php/Act/index1/id/1/userId/" . $aaa . "';</script>";
                 //$this -> success('登录成功','__APP__/Act/index1/id/1/userId/'.$aaa);
             } else {
                 echo "<script type='text/javascript'>alert('登录成功');location='/index.php/Act/actlist';</script>";
                 //$this -> success('登录成功','__APP__/Act/actlist');
             }
             exit;
         } else {
             echo "<script type='text/javascript'>alert('用户不存在!');location='/index.php/Login';</script>";
             //$this -> error('用户不存在!');
         }
     }
     $this->display();
 }
开发者ID:JaylonQi,项目名称:kj,代码行数:35,代码来源:LoginAction.class.php


注:本文中的M函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。