本文整理汇总了PHP中Load函数的典型用法代码示例。如果您正苦于以下问题:PHP Load函数的具体用法?PHP Load怎么用?PHP Load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doadd
public function doadd()
{
if ($_SESSION['authId'] != 1) {
alert('无权操作!', 1);
}
$admin = M('admin');
$data['username'] = $_POST['username'];
if ($admin->where('username=\'' . $_POST['username'] . '\'')->find()) {
alert('用户名已存在!', 1);
}
if (empty($_POST['password'])) {
alert('密码不能为空!', 1);
}
$data['lastlogintime'] = time();
Load('extend');
$data['lastloginip'] = get_client_ip();
$data['password'] = md5('wk' . $_POST['password'] . 'cms');
$role = M('role_admin');
if ($admin->add($data)) {
$map['user_id'] = $admin->where('username=\'' . $_POST['username'] . '\'')->getField('id');
$map['role_id'] = 1;
$role->add($map);
alert('操作成功!密码为:' . $_POST['password'], U('Admin/index'));
}
alert('操作失败!', 1);
}
示例2: index
/**
* 最新资讯
*/
public function index()
{
// 渲染TDK
$this->tdk(4);
// 导航高亮
$this->assign('highline', 4);
// 渲染导航条
$this->navigation();
// 渲染右边悬浮框
$this->right();
// 资讯分类
$category = M('NewsCategory')->order("add_time ASC")->select();
if ($category) {
$id = isset($_GET['category']) ? intval($_GET['category']) : $category[0]['id'];
if (!M('NewsCategory')->where(array('id' => $id))->count()) {
$this->redirect('/news/index?category=' . $category[0]['id']);
}
Load('extend');
import('ORG.Util.Page');
$news = M('News');
$count = $news->where(array('category_id' => $id))->count();
$page = new Page($count, 10);
$page->setConfig('theme', "共 %totalRow% %header% %nowPage%/%totalPage%页 %upPage% %downPage% %first% %prePage% %linkPage% %nextPage% %end%");
$page->setConfig('header', '篇资讯');
$show = $page->show();
$newsLists = $news->where(array('category_id' => $id))->order("add_time DESC")->limit($page->firstRow, $page->listRows)->select();
$this->assign('newsLists', $newsLists);
$this->assign('count', ceil($count / 10));
$this->assign('page', $show);
$this->assign('category', $category);
}
$this->assign('id', $id);
$this->display();
}
示例3: _initialize
/**
* 系统初始化方法
*
* @access protected
*/
protected function _initialize()
{
header("Content-type:text/html;charset=utf-8");
Load('extend');
$this->ajax = $this->IS_AJAX;
$this->post = strtolower($_SERVER['REQUEST_METHOD']) == 'post';
$this->ip = get_client_ip();
$this->timestamp = time();
$this->root_path = dirname($_SERVER['PHP_SELF']);
$this->root_path = $this->root_path == '\\' || $this->root_path == '/' ? '' : $this->root_path;
define('__ROOT_PATH__', $this->root_path);
C('TMPL_PARSE_STRING.__ROOT_PATH__', __ROOT_PATH__);
$this->site_cfg = F('site_cfg');
$this->assign('site_cfg', $this->site_cfg);
define('__TPL_PATH__', '/Application/Home/View');
C('TMPL_PARSE_STRING.__TPL_PATH__', __TPL_PATH__);
$this->upload_dir = $this->root_path . '/upload/';
define('__UPLOAD_PATH__', $this->upload_dir);
C('TMPL_PARSE_STRING.__UPLOAD_PATH__', __UPLOAD_PATH__);
// 如果当前用户验证身份cookie有效则获取相用户信息
$_SESSION['auth'] = isset($_SESSION['auth']) ? $_SESSION['auth'] : '';
if ($_SESSION['auth'] != '' && $this->validAuthCookie()) {
C('formtoken_extra', $this->user['mid'] . $this->user['password']);
}
if (method_exists($this, '_init')) {
$this->_init();
}
}
示例4: _initialize
public function _initialize()
{
if (!isset($_COOKIE['username']) || !isset($_COOKIE['usernumber'])) {
$this->redirect('Admin/Index/login');
}
Load('extend');
}
示例5: index
public function index()
{
$news = M("news")->select();
$this->assign('news', $news);
// $type=M("type")->select();
// $this->assign('type',Tool::tree($type));
Load('extend');
//加载扩展方法
$type = D('type');
// $data['type'] = 'type';
$list = $type->order('id asc')->select();
//实现同级节点排序
$list = list_to_tree($list, 'id', 'tid');
//详细参数见手册
// dump($list);
$this->assign('type', $list);
$data['typeid'] = $_GET["_URL_"][3];
// dump($data);
if (is_null($data['typeid'])) {
# code...
$this->assign('new', $news[0]);
//dump($news[0]);
} else {
$new = M('news')->where($data)->select();
$this->assign('new', $new[0]);
// dump($new);
}
$this->display();
}
示例6: index
public function index()
{
Load('extend');
//加载扩展函数,模板里需要使用
$pl = M('pl');
import('@.ORG.Page');
if (isset($_GET['status'])) {
$count = $pl->where('status=' . $_GET['status'])->order('ptime desc')->count();
$p = new Page($count, 20);
$list = $pl->where('status=' . $_GET['status'])->order('ptime desc')->limit($p->firstRow . ',' . $p->listRows)->select();
} elseif (isset($_GET['keyword'])) {
$map['content'] = array('like', '%' . $_GET['keyword'] . '%');
$count = $pl->where($map)->order('ptime desc')->count();
$p = new Page($count, 20);
$list = $pl->where($map)->order('ptime desc')->limit($p->firstRow . ',' . $p->listRows)->select();
} else {
$count = $pl->order('ptime desc')->count();
$p = new Page($count, 20);
$list = $pl->order('ptime desc')->limit($p->firstRow . ',' . $p->listRows)->select();
}
$p->setConfig('prev', '上一页');
$p->setConfig('header', '条评论');
$p->setConfig('first', '首 页');
$p->setConfig('last', '末 页');
$p->setConfig('next', '下一页');
$p->setConfig('theme', "%first%%upPage%%linkPage%%downPage%%end%\r\n\t\t<li><span><select name='select' onChange='javascript:window.location.href=(this.options[this.selectedIndex].value);'>%allPage%</select></span></li>\n<li><span>共<font color='#009900'><b>%totalRow%</b></font>条评论 20条/每页</span></li>");
$this->assign('page', $p->show());
$this->assign('list', $list);
$this->display();
}
示例7: System_Load
function System_Load($Name)
{
/****************************************************************************/
$__args_types = array('string');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$Paths = Func_Get_Args();
if (!Count($Paths)) {
return ERROR | @Trigger_Error('[System_Load]: не передан ни один путь к системному компоненту');
}
#-----------------------------------------------------------------------------
$Loaded =& Link_Get('System', 'array');
#-----------------------------------------------------------------------------
foreach ($Paths as $Path) {
#---------------------------------------------------------------------------
if (System_IsLoaded($Path)) {
continue;
}
#---------------------------------------------------------------------------
$Loaded[] = $Path;
#---------------------------------------------------------------------------
$Path = System_Element(SPrintF('system/%s', $Path));
if (Is_Error($Path)) {
return ERROR | @Trigger_Error('[System_Load]: включение не найдено');
}
#---------------------------------------------------------------------------
if (Is_Error(Load($Path))) {
return ERROR | @Trigger_Error('[System_Load]: не удалось загрузить включение');
}
#---------------------------------------------------------------------------
Debug(SPrintF('[System_Load]: компонент системы (%s) был загружен', $Path));
}
}
示例8: index
function index()
{
Load('extend');
$condition['user_id'] = Cookie::get('user_id');
$data = $this->indexModel->getIndexData($condition);
$this->assign('data', $data);
$this->display();
}
示例9: index
function index()
{
Load('extend');
$id = intval($_GET['id']);
$data = $this->goodslistModel->getGoodslistIndexData($id);
$this->assign('data', $data);
$this->display();
}
示例10: _initialize
function _initialize()
{
Load('extend');
import("ORG.Util.Page");
$nav_list = D('Category')->relation(true)->where('pid=0 AND status=1')->order('sort DESC')->select();
$this->assign('link', D('Link')->where('status=1')->order('sort DESC')->limit(7)->select());
$this->assign('nav_list', $nav_list);
}
示例11: index
public function index()
{
Load('extend');
$Data = M('Article');
$list = $Data->order('publish_time DESC')->select();
$this->assign('list', $list);
$this->display();
}
示例12: _initialize
public function _initialize()
{
/*
* 载入各种扩展
*/
//import("ORG.Util.Image"); //图像操作类库
Load('extend');
//Think扩展函数库
}
示例13: Editing
function Editing($va)
{
$vaLevel = scSys::GetKeterangan("Kode,Keterangan,Isi", "Kode = '{$va['cKode']}'", "username_level");
Load($va['cKode']);
echo '
$("#cKeterangan").val("' . $vaLevel['Keterangan'] . '") ;
$("#nLevel").val("' . $vaLevel['Kode'] . '") ;
';
}
示例14: _initialize
public function _initialize()
{
/* 导航菜单 */
$menuModel = M('Menu');
$menuwhere['type'] = "1";
$menuresult = $menuModel->where($menuwhere)->order('sort')->limit(6)->select();
$this->assign('menu', $menuresult);
/* //seo
$systemConfig = include WEB_ROOT . 'Common/systemConfig.php';
F("systemConfig", $systemConfig, WEB_ROOT . "Common/");
$this->assign("site", $systemConfig); */
//网站配置
$this->assign('webset', M('Setting')->select());
Load('extend');
//导航数据组装
$nav_list = D('Category')->where('pid=0 AND status=1')->order('sort DESC')->select();
if (is_array($nav_list)) {
foreach ($nav_list as $key => $val) {
$nav_list[$key] = $this->changurl($val);
$nav_list[$key]['sub_nav'] = D('Category')->where('pid=' . $val['id'] . ' AND status=1')->select();
foreach ($nav_list[$key]['sub_nav'] as $key2 => $val2) {
$nav_list[$key]['sub_nav'][$key2] = $this->changurl($val2);
}
}
}
//最热文章数据组装
$hot_art = D('Article')->where('status=1')->order('apv DESC')->limit(8)->select();
if (is_array($hot_art)) {
foreach ($hot_art as $key => $val) {
$hot_art[$key] = $this->changurl($val);
}
}
$this->assign('hot_art', $hot_art);
//最热文章数据组装
$new_art = D('Article')->where('status=1')->order('add_time DESC')->limit(8)->select();
if (is_array($new_art)) {
foreach ($new_art as $key => $val) {
$new_art[$key] = $this->changurl($val);
}
}
$this->assign('new_art', $new_art);
//最新留言
$new_leave = D('Message')->where('status=1 AND pid=0 AND aid=0')->order('add_time DESC')->limit(5)->select();
foreach ($new_leave as $key => $val) {
$new_leave[$key] = $this->msgmodify($val);
}
$this->assign('new_leave', $new_leave);
//最新评论
$new_comment = D('Message')->where('status=1 AND pid=0 AND aid!=0')->order('add_time DESC')->limit(5)->select();
foreach ($new_comment as $key => $val) {
$new_comment[$key] = $this->msgmodify($val);
}
$this->assign('new_comment', $new_comment);
$this->assign('link', D('Link')->where('status=1')->order('sort DESC')->limit(8)->select());
$this->assign('nav_list', $nav_list);
}
示例15: checkLogin
function checkLogin()
{
if (empty($_POST['username'])) {
alert("帐号错误", 1);
} elseif (empty($_POST['password'])) {
alert("密码必须!", 1);
} elseif (empty($_POST['verify'])) {
alert('验证码必须!', 1);
}
if (md5($_POST['verify']) != $_SESSION['verify']) {
alert('验证码错误!', 1);
}
//生成认证条件
$map = array();
// 支持使用绑定帐号登录
$map['username'] = $_POST['username'];
$map["status"] = array('gt', 0);
import('ORG.Util.RBAC');
$authInfo = RBAC::authenticate($map);
//使用用户名、密码和状态的方式进行认证
if (false === $authInfo) {
alert('帐号不存在!', 1);
}
if (empty($authInfo)) {
alert('帐号不存在或已禁用!', 1);
}
$pwdinfo = strcmp($authInfo['password'], md5('wk' . $_POST['password'] . 'cms'));
if ($pwdinfo != 0) {
alert('密码错误!', 1);
}
$_SESSION[C('USER_AUTH_KEY')] = $authInfo['id'];
$_SESSION['username'] = $_POST['username'];
$role = M('role_admin');
$authInfo['role_id'] = $role->where('user_id=' . $authInfo['id'])->getField('role_id');
if ($authInfo['role_id'] == '1') {
$_SESSION['administrator'] = true;
}
//保存登录信息
$admin = M('admin');
Load('extend');
$ip = get_client_ip();
$time = time();
$data = array();
$data['id'] = $authInfo['id'];
$data['lastlogintime'] = $time;
$data['lastloginip'] = $ip;
$admin->save($data);
// 缓存访问权限
RBAC::saveAccessList();
//保存cookie信息
Cookie::set('waikucms', '1', 60 * 60 * 3);
//dump($authInfo);
$this->index();
}