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


PHP U函数代码示例

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


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

示例1: edit

 public function edit()
 {
     if (IS_POST) {
         $post_data = I('post.');
         $post_data["rules"] = I("post.rules");
         $post_data["rules"] = implode(",", $post_data["rules"]);
         $data = $this->Model->create($post_data);
         if ($data) {
             $result = $this->Model->where(array('id' => $post_data['id']))->save($data);
             if ($result) {
                 action_log('Edit_AuthGroup', 'AuthGroup', $post_data['id']);
                 $this->success("操作成功!", U('index'));
             } else {
                 $error = $this->Model->getError();
                 $this->error($error ? $error : "操作失败!");
             }
         } else {
             $error = $this->Model->getError();
             $this->error($error ? $error : "操作失败!");
         }
     } else {
         $_info = I('get.');
         $_info = $this->Model->where(array('id' => $_info['id']))->find();
         $this->assign('_info', $_info);
         $this->display();
     }
 }
开发者ID:hacklx,项目名称:koala-frame,代码行数:27,代码来源:AuthGroupController.class.php

示例2: __autoload

 protected function __autoload()
 {
     parent::__autoload();
     if (MODULE_NAME == "Home" || MODULE_NAME == "User") {
         session('loginout_url', U('/'));
     } else {
         session('loginout_url', U(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME, param()));
     }
     if (MODULE_NAME == "Home" || MODULE_NAME == "User" && (CONTROLLER_NAME == "Register" || CONTROLLER_NAME == "Login")) {
         session('login_url', U('/'));
     } else {
         session('login_url', U(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME, param()));
     }
     if (C("SITE_STATUS") != 1 && !$_SESSION["admin_member_id"]) {
         $this->error("站点已关闭");
     }
     $this->__init();
     $img_type = array('jpg', 'gif', 'png', 'jpeg', 'bmp');
     /*设定图片格式,退款凭证显示图标用*/
     $language = get_language_recommend_cache();
     /*查询推荐的源语言*/
     $all_themes = array_id_key(get_themes_cache());
     /*查询平台拥有的所有皮肤,并将ID转换成KEY*/
     $data['all_theme'] = $all_themes;
     $data['recommend_language'] = $language;
     $data['img_type'] = $img_type;
     $this->assign($data);
     /*@刘巧刷新消息*/
     session('news_num', get_news_recode(session('home_member_id')));
 }
开发者ID:976112643,项目名称:manor,代码行数:30,代码来源:HomeController.class.php

示例3: step3

 public function step3()
 {
     if (IS_POST) {
         if ($_POST['if2011'] != '是') {
             $this->error("您已放弃报名", addons_url('Join2011://Join2011/index'));
         }
         //print_array($_POST);
         $Stu = D('Stu');
         $Bmb = D('Bmb');
         $data['ksh'] = $_SESSION['ksh'];
         $data['score'] = $_POST['score'];
         $data['jsscore'] = $_POST['jsscore'];
         $data['phone'] = $_POST['phone'];
         if ($Stu->where(array('ksh' => $_SESSION['ksh']))->find()) {
         } else {
             $this->error("您不在初选名单", addons_url('Join2011://Join2011/index'));
         }
         if ($Bmb->where(array('ksh' => $_SESSION['ksh']))->find()) {
             $this->error("您已经报名", addons_url('Join2011://Join2011/index'));
         }
         if ($Bmb->data($data)->add()) {
             session('ksh', '');
             $this->success('报名成功', U('Home/Index/index'));
         } else {
             $this->error("报名失败,请重新报名", addons_url('Join2011://Join2011/index'));
         }
     } else {
         $this->error("您不可以直接访问这个页面", addons_url('Join2011://Join2011/index'));
     }
 }
开发者ID:jackycgq,项目名称:GreenCMS,代码行数:30,代码来源:Join2011Controller.class.php

示例4: add_post

 function add_post()
 {
     if (IS_POST) {
         if (!empty($_POST['role_id']) && is_array($_POST['role_id'])) {
             $role_ids = $_POST['role_id'];
             unset($_POST['role_id']);
             if ($this->users_obj->create()) {
                 $result = $this->users_obj->add();
                 if ($result !== false) {
                     $role_user_model = M("RoleUser");
                     foreach ($role_ids as $role_id) {
                         $role_user_model->add(array("role_id" => $role_id, "user_id" => $result));
                     }
                     $this->success("添加成功!", U("user/index"));
                 } else {
                     $this->error("添加失败!");
                 }
             } else {
                 $this->error($this->users_obj->getError());
             }
         } else {
             $this->error("请为此用户指定角色!");
         }
     }
 }
开发者ID:bxq2013,项目名称:thinkcmf_wechat,代码行数:25,代码来源:UserController.class.php

示例5: content_5638503aa35533_60603029

    function content_5638503aa35533_60603029($_smarty_tpl)
    {
        $_smarty_tpl->properties['nocache_hash'] = '17972065005638503a9da791_81598189';
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
		<link rel="stylesheet" href="./Public/Admin/Css/add_category.css" />
	<title></title>
</head>
<body>
	<form action="<?php 
        echo U('Category/addTopCate');
        ?>
" method="post">
		<table class="table">
			<tr >
				<td class="th" colspan="2">添加顶级分类</td>
			</tr>
			<tr>
				<td>分类名称</td>
				<td><input type="text" name="title"/></td>
			</tr>
			<tr>
				<td colspan="2">
					<input type="submit" value="添加" class="input_button"/>
					<input type="reset" class="input_button"/>
				</td>
			</tr>
		</table>
	</form>
</body>
</html><?php 
    }
开发者ID:symoo,项目名称:project,代码行数:35,代码来源:066ff1659aaf3a3af980ef1e85b55d0255e0e596_0.file.addTopCate.html.php

示例6: update

 public function update($admin_id)
 {
     $admin_id = $admin_id + 0;
     $model = new \Model\AdminModel();
     if (IS_POST) {
         if ($data = $model->create()) {
             $password = I('post.password');
             //判断有没有输入新密码
             if (empty($password)) {
                 unset($data['password']);
             } else {
                 //重新生成密码和salt
                 $str = uniqid();
                 $salt = substr($str, -6);
                 $password = I('post.password');
                 //生成密码
                 $data['password'] = md5(md5($password) . $salt);
                 $data['salt'] = $salt;
             }
             if ($model->save($data) !== false) {
                 $this->success('修改管理员成功', U('showlist'), 1);
                 exit;
             }
             $this->error('修改管理员失败');
         }
         $this->error($model->getError());
     }
     //获取要修改管理员的属性并显示
     $info = $model->field('admin_id,admin_name,role_id')->join("left join it_admin_role using(admin_id)")->find($admin_id);
     $this->assign('info', $info);
     //获取角色并遍历显示
     $role_list = M('Role')->select();
     $this->assign('role_list', $role_list);
     $this->display();
 }
开发者ID:VenusGrape,项目名称:hymall,代码行数:35,代码来源:AdminController.class.php

示例7: checkUser

 public function checkUser()
 {
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         $keys['redirect_uri'] = U('public/Widget/displayAddons', array('type' => $_REQUEST['type'], 'addon' => 'Login', 'hook' => 'no_register_display'));
         try {
             $token = $this->_oauth->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
             $token = null;
         }
     } else {
         $keys = array();
         $keys['refresh_token'] = $_REQUEST['code'];
         try {
             $token = $this->_oauth->getAccessToken('token', $keys);
         } catch (OAuthException $e) {
             $token = null;
         }
     }
     if ($token) {
         setcookie('weibojs_' . $this->_oauth->client_id, http_build_query($token));
         $_SESSION['sina']['access_token']['oauth_token'] = $token['access_token'];
         $_SESSION['sina']['access_token']['oauth_token_secret'] = $token['refresh_token'];
         $_SESSION['sina']['expire'] = time() + $token['expires_in'];
         $_SESSION['sina']['uid'] = $token['uid'];
         $_SESSION['open_platform_type'] = 'sina';
         return $token;
     } else {
         return false;
     }
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:32,代码来源:sina.class.php

示例8: getMediaIdByGroupId

 /**
  * 获取导航列表,支持多级导航
  *
  * @param boolean $field
  *        	要列出的字段
  * @return array 导航树
  * @author 麦当苗儿 <zuojiazi@vip.qq.com>
  */
 public function getMediaIdByGroupId($group_id)
 {
     $map['group_id'] = $group_id;
     $list = $this->where($map)->order('id asc')->select();
     if (!empty($list[0]['media_id'])) {
         return $list[0]['media_id'];
     }
     // 自动同步到微信端
     foreach ($list as $vo) {
         $data['title'] = $vo['title'];
         $data['thumb_media_id'] = empty($vo['thumb_media_id']) ? $this->_thumb_media_id($vo['cover_id']) : $vo['thumb_media_id'];
         $data['author'] = $vo['author'];
         $data['digest'] = $vo['intro'];
         $data['show_cover_pic'] = 1;
         $data['content'] = $vo['content'];
         $data['content_source_url'] = U('news_detail', array('id' => $vo['id']));
         $articles[] = $data;
     }
     $url = 'https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=' . get_access_token();
     $param['articles'] = $articles;
     $res = post_data($url, $param);
     if ($res['errcode'] != 0) {
         return false;
     } else {
         $this->where($map)->setField('media_id', $res['media_id']);
         return $res['media_id'];
     }
 }
开发者ID:walkingmanc,项目名称:weshop,代码行数:36,代码来源:MaterialModel.class.php

示例9: add

 public function add()
 {
     $id = I('id');
     $p_id = I('p_id');
     if (IS_POST) {
         $p['category_name'] = I('category_name');
         $p['status'] = I('state');
         $p['sort'] = I('order');
         $p['is_home'] = I('is_home');
         $p['home_num'] = I('home_num');
         $p['ad_url'] = I('ad_url');
         $p['catepic_url'] = I('catepic_url');
         $p['sku'] = I('sku');
         $p['is_home_banner'] = I('is_home_banner');
         $p['is_home_banner_type'] = I('is_home_banner_type');
         $p['color'] = I('color');
         if ($id) {
             M('CategoryGoods')->where("id='{$id}'")->save($p);
             $this->success('修改成功');
         }
         $p['p_id'] = I('p_id');
         if ($p['p_id']) {
             $category = M('CategoryGoods')->where("id='{$p['p_id']}'")->find();
             !$category && $this->error('没有上级栏目');
         }
         M('CategoryGoods')->add($p);
         $this->success('添加成功', U('add'));
     }
     $this->assign('id', $id);
     $this->assign('p_id', $p_id);
     $id && $this->assign('category', M('CategoryGoods')->find($id));
     $this->display();
 }
开发者ID:MRdou325,项目名称:lvyou,代码行数:33,代码来源:CategoryGoodsController.class.php

示例10: menu

 public function menu()
 {
     //$this->checkUser();
     //显示菜单项
     $id = intval($_REQUEST['tag']) == 0 ? 6 : intval($_REQUEST['tag']);
     $menu = array();
     $role_id = D('admin')->where('id=' . $_SESSION['admin_info']['id'])->getField('role_id');
     $node_ids_res = D("access")->where("role_id=" . $role_id)->field("node_id")->select();
     $node_ids = array();
     foreach ($node_ids_res as $row) {
         array_push($node_ids, $row['node_id']);
     }
     //读取数据库模块列表生成菜单项
     $node = M("node");
     $where = "auth_type<>2 AND status=1 AND is_show=0 AND group_id=" . $id;
     $list = $node->where($where)->field('id,action,action_name,module,module_name,data')->order('sort DESC')->select();
     foreach ($list as $key => $action) {
         $data_arg = array();
         if ($action['data']) {
             $data_arr = explode('&', $action['data']);
             foreach ($data_arr as $data_one) {
                 $data_one_arr = explode('=', $data_one);
                 $data_arg[$data_one_arr[0]] = $data_one_arr[1];
             }
         }
         $action['url'] = U($action['module'] . '/' . $action['action'], $data_arg);
         if ($action['action']) {
             $menu[$action['module']]['navs'][] = $action;
         }
         $menu[$action['module']]['name'] = $action['module_name'];
         $menu[$action['module']]['id'] = $action['id'];
     }
     $this->assign('menu', $menu);
     $this->display('left');
 }
开发者ID:nexteee,项目名称:php,代码行数:35,代码来源:publicAction.class.php

示例11: delete

 public function delete()
 {
     $id = I('get.id');
     $res = D('Develop')->delete($id);
     $mess = new MessController();
     $mess->message($res, '删除成功', '删除失败', U('Develop/index', array('mess' => '删除成功')));
 }
开发者ID:pengfen,项目名称:resource,代码行数:7,代码来源:LessonCommentController.class.php

示例12: edit

 function edit()
 {
     if (isset($_POST['dosubmit'])) {
         $node_mod = D('wf_node');
         $data = $node_mod->create();
         if ($data['node_id'] == 0) {
             $this->error('请选择分类');
         }
         $result = $node_mod->save($data);
         if (false !== $result) {
             $this->success(L('operation_success'), U('WFNode/index'));
         } else {
             $this->error(L('operation_failure'));
         }
     } else {
         $node_mod = D('wf_node');
         if (isset($_GET['node_id'])) {
             $node_id = isset($_GET['node_id']) && intval($_GET['node_id']) ? intval($_GET['node_id']) : $this->error(L('please_select'));
         }
         $defination_mod = D('wf_defination');
         $result = $defination_mod->order('defination_id ASC')->select();
         $defination_list = array();
         foreach ($result as $val) {
             if ($val['pid'] == 0) {
                 $defination_list['parent'][$val['defination_id']] = $val;
             }
         }
         $note_info = $node_mod->where('node_id=' . $node_id)->find();
         $this->assign('show_header', false);
         $this->assign('defination_list', $defination_list);
         $this->assign('node', $note_info);
         $this->display();
     }
 }
开发者ID:omusico,项目名称:workflow,代码行数:34,代码来源:WFNodeAction.class.php

示例13: add

 public function add()
 {
     $brand = D('brand');
     $list = $this->menulist();
     if (IS_POST) {
         //提交表单
         $brandid = $_POST["ypid"];
         $good = $_POST["goodid"];
         if ($brand->where("ypid='{$brandid}'")->select()) {
             $brand->where("ypid='{$brandid}'")->delete();
         }
         if (false !== $brand->update()) {
             $this->success('新增成功!', U('index'));
         } else {
             $error = $brand->getError();
             $this->error(empty($error) ? '未知错误!' : $error);
         }
     } else {
         $cate = array();
         if ($pid) {
             /* 获取上级信息 */
             $cate = $brand->info($pid, 'id,title,status');
             if (!($cate && 1 == $cate['status'])) {
                 $this->error('指定的上级分类不存在或被禁用!');
             }
         }
         /*品牌信息 */
         $this->assign('list', $list);
         $this->assign('info', null);
         $this->assign('category', $cate);
         $this->meta_title = '新增优惠券';
         $this->display();
     }
 }
开发者ID:kevins1022,项目名称:tpshop,代码行数:34,代码来源:BrandController.class.php

示例14: cache

 public function cache()
 {
     if (isset($_GET['type'])) {
         $Dir = new \Dir();
         $cache = D('Common/Cache');
         $type = I('get.type');
         switch ($type) {
             case "template":
                 //删除缓存目录下的文件
                 $Dir->del(RUNTIME_PATH);
                 $Dir->delDir(RUNTIME_PATH . "Cache/");
                 $Dir->delDir(RUNTIME_PATH . "Temp/");
                 //更新开启其他方式的缓存
                 \Think\Cache::getInstance()->clear();
                 $this->success("模板缓存清理成功!", U('Index/cache'));
                 break;
             case "logs":
                 $Dir->delDir(RUNTIME_PATH . "Logs/");
                 $this->success("站点日志清理成功!", U('Index/cache'));
                 break;
             default:
                 $this->error("请选择清楚缓存类型!");
                 break;
         }
     } else {
         $this->display();
     }
 }
开发者ID:gzwyufei,项目名称:hp,代码行数:28,代码来源:IndexController.class.php

示例15: add

 public function add()
 {
     $model = $this->model;
     $Model = D(parse_name(get_table_name($model['id']), 1));
     if (IS_POST) {
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && ($id = $Model->add())) {
             $this->_saveKeyword($model, $id, 'custom_reply_text');
             $this->success('添加' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
         } else {
             $this->error($Model->getError());
         }
     } else {
         $fields = get_model_attribute($model['id']);
         $extra = $this->getCateData();
         if (!empty($extra)) {
             foreach ($fields[1] as &$vo) {
                 if ($vo['name'] == 'cate_id') {
                     $vo['extra'] .= "\r\n" . $extra;
                 }
             }
         }
         $this->assign('fields', $fields);
         $this->meta_title = '新增' . $model['title'];
         $this->display();
     }
 }
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:28,代码来源:CustomReplyTextController.class.php


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