本文整理匯總了PHP中Cookie函數的典型用法代碼示例。如果您正苦於以下問題:PHP Cookie函數的具體用法?PHP Cookie怎麽用?PHP Cookie使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Cookie函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
// 記錄當前列表頁的cookie
Cookie('__forward__', $_SERVER['REQUEST_URI']);
$this->meta_title = '欄目管理';
$this->display('Profile/Category/index');
}
示例2: edit
public function edit($id = null)
{
if (IS_POST) {
$SeoRule = D('SeoRule');
$data = $SeoRule->create();
if ($data) {
if ($SeoRule->save()) {
$cacheKey = "qt_seo_meta_" . $data['app'] . "_" . $data['controller'] . "_" . $data['action'];
S($cacheKey, null);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失敗');
}
} else {
$this->error($SeoRule->getError());
}
} else {
$info = array();
$info = M('SeoRule')->field(true)->find($id);
if (false === $info) {
$this->error('獲取配置信息錯誤');
}
$this->assign('info', $info);
$this->display();
}
}
示例3: login
/**
* 登陸
*/
public function login()
{
if (IS_POST) {
$username = I('username');
$password = I('password');
$remenber = I('remenber');
if (!$username) {
$this->error('請輸入姓名!');
}
if (!$password) {
$this->error('請輸入身份證!');
}
$user_object = D('Student');
$uid = $user_object->login($username, $password);
if (0 < $uid) {
$this->success('登錄成功!', Cookie('__forward__') ?: C('HOME_PAGE'));
} else {
$this->error($user_object->getError());
}
} else {
if (is_login()) {
$this->error("您已登陸係統", Cookie('__forward__') ?: C('HOME_PAGE'));
}
$this->display();
}
}
示例4: index
public function index()
{
$banner = $this->getBanner($this->PageFeature['ControllerName']);
$this->assign('banner', $banner);
$tab = $this->getTab();
$this->assign('tabs', $tab);
$tabVideo = NULL;
//獲得tabVideo
foreach ($tab as $key => $value) {
$tabVideo[$key] = $this->getTabVideo($value['id']);
//轉換數據
foreach ($tabVideo[$key] as $key1 => $value1) {
$tabVideo[$key][$key1]['create_time'] = date('Y-m-d', $value1['create_time']);
$tabVideo[$key][$key1]['update_time'] = date('Y-m-d', $value1['update_time']);
//獲得教師信息
$teach = $this->getInfo($value1['authority']);
$tabVideo[$key][$key1]['name'] = $teach[0]['name'];
$tabVideo[$key][$key1]['company'] = $teach[0]['company'];
//var_dump( $value1);
}
}
Cookie('__forward__', $_SERVER['REQUEST_URI']);
$this->assign('tabVideo', $tabVideo);
$this->display();
}
示例5: edit
/**
* 編輯訂單
* @author 煙消雲散 <1010422715@qq.com>
*/
public function edit($id = 0)
{
if (IS_POST) {
$Form = D('change');
if ($_POST["id"]) {
$id = $_POST["id"];
$Form->create();
$result = $Form->where("id='{$id}'")->save();
if ($result) {
//記錄行為
action_log('update_change', 'change', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失敗,換貨單' . $id);
}
} else {
$this->error($Config->getError());
}
} else {
$info = array();
/* 獲取數據 */
$info = M('change')->find($id);
$list = M('change')->where("shopid='{$id}'")->select();
if (false === $info) {
$this->error('獲取訂單信息錯誤');
}
$this->assign('list', $list);
$this->assign('info', $info);
$this->meta_title = '編輯訂單';
$this->display();
}
}
示例6: edit
/**
* 編輯
* @author 煙消雲散 <1010422715@qq.com>
*/
public function edit($id = 0)
{
if (IS_POST) {
$Form = D('records');
if ($_POST["id"]) {
$id = $_POST["id"];
/*更新時間*/
$Form->time = NOW_TIME;
/* 編輯後新增係統反饋信息*/
$Form->info = $_POST["info"];
$result = $Form->where("id='{$id}'")->save();
if ($result) {
//記錄行為
action_log('update_backlist', 'backlist', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失敗' . $id);
}
} else {
$this->error($Config->getError());
}
} else {
$info = array();
/* 獲取數據 */
$info = M('records')->find($id);
$list = M('records')->where("id='{$id}'")->select();
if (false === $info) {
$this->error('獲取訂單信息錯誤');
}
$this->assign('list', $list);
$this->assign('info', $info);
$this->meta_title = '編輯訂單';
$this->display();
}
}
示例7: edit
/**
* 編輯配置
* @author 麥當苗兒 <zuojiazi@vip.qq.com>
*/
public function edit($id = 0)
{
$DataModel = D('Friendlink');
if (IS_POST) {
$data = $DataModel->create();
if ($data) {
if ($DataModel->save($data)) {
S('DB_CONFIG_DATA', null);
//設置緩存
//記錄行為
action_log('update_config', 'Friendlink', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失敗');
}
} else {
$this->error($DataModel->getError());
}
} else {
$info = array();
/* 獲取數據 */
$info = $DataModel->field(true)->find($id);
if (false === $info) {
$this->error('獲取配置信息錯誤');
}
$this->assign('info', $info);
$this->meta_title = '編輯配置';
$this->display();
}
}
示例8: login
/**
* 管理員登錄
*/
public function login()
{
if (IS_POST) {
$adm_id = I('adm_id');
$adm_pw = I('adm_pw');
# 圖片驗證碼校驗
if (!$this->check_verify(I('post.verify'))) {
$this->error('驗證碼輸入錯誤!');
}
if (!$adm_id) {
$this->error('請輸入管理員!');
}
if (!$adm_pw) {
$this->error('請輸入密碼!');
}
$ADM = D('Admin');
$uid = $ADM->login($adm_id, $adm_pw);
if (0 < $uid) {
$this->redirect('Index/index');
} else {
$this->error($ADM->getError());
}
} else {
if (is_login('Admin')) {
$this->error("您已登陸係統", Cookie('__forward__') ?: C('HOME_PAGE'));
}
$this->meta_title = '管理員登錄';
$this->display();
}
}
示例9: edit
/**
* 編輯配置
* @author yangweijie <yangweijiester@gmail.com>
*/
public function edit($id = 0)
{
if (IS_POST) {
$Menu = D('Menu');
$data = $Menu->create();
if ($data) {
if ($Menu->save() !== false) {
// S('DB_CONFIG_DATA',null);
//記錄行為
action_log('update_menu', 'Menu', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失敗');
}
} else {
$this->error($Menu->getError());
}
} else {
$info = array();
/* 獲取數據 */
$info = M('Menu')->field(true)->find($id);
$menus = M('Menu')->field(true)->select();
$menus = D('Common/Tree')->toFormatTree($menus);
$menus = array_merge(array(0 => array('id' => 0, 'title_show' => '頂級菜單')), $menus);
$this->assign('Menus', $menus);
if (false === $info) {
$this->error('獲取後台菜單信息錯誤');
}
$this->assign('info', $info);
$this->meta_title = '編輯後台菜單';
$this->display();
}
}
示例10: edit
/**
* 編輯業務
* @author 溫開元<wenkaiyuan.6@163.com 594164084@qq.com>
*/
public function edit($id = 0)
{
if (IS_POST) {
$Business = D('Business');
$data = $Business->create();
if ($data) {
if ($Business->save()) {
//記錄行為
// action_log('update_business', 'Business', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失敗');
}
} else {
$this->error($Business->getError());
}
} else {
$info = array();
/* 獲取數據 */
$info = M('Business')->field(true)->find($id);
if (false === $info) {
$this->error('獲取業務信息錯誤');
}
$this->assign('info', $info);
$this->meta_title = '編輯業務';
$this->display();
}
}
示例11: edit
public function edit($id = null)
{
if (IS_POST) {
$Config = D('SystemConfig');
$data = $Config->create();
if ($data) {
if ($Config->save()) {
S('DB_CONFIG_DATA', null);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失敗');
}
} else {
$this->error($Config->getError());
}
} else {
$info = array();
$info = M('SystemConfig')->field(true)->find($id);
if (false === $info) {
$this->error('獲取配置信息錯誤');
}
$this->assign('info', $info);
$this->display();
}
}
示例12: save
function save()
{
$Brand = D('Brand');
$data = $Brand->create();
if ($data) {
$id = $Brand->add();
if ($id) {
// S('DB_CONFIG_DATA',null);
//記錄行為
action_log('update_menu', 'Menu', $id, UID);
$this->success('新增成功', Cookie('__forward__'));
} else {
$this->error('新增失敗');
}
} else {
$this->error($Brand->getError());
}
// if(IS_POST){
//
// } else {
// $this->assign('info',array('pid'=>I('pid')));
// $menus = M('Menu')->field(true)->select();
// $menus = D('Common/Tree')->toFormatTree($menus);
// $menus = array_merge(array(0=>array('id'=>0,'title_show'=>'頂級菜單')), $menus);
// $this->assign('Menus', $menus);
// $this->meta_title = '新增菜單';
// $this->display('edit');
// }
}
示例13: edit
/**
* 編輯配置
* @author 麥當苗兒 <zuojiazi@vip.qq.com>
*/
public function edit($id = 0)
{
$DataModel = D('ResourceTab');
if (IS_POST) {
//$Config = D('Config');
$data = $DataModel->create();
if ($data) {
if ($DataModel->updateData(null, $data)) {
S('DB_TAB_DATA', null);
//記錄行為
action_log('update_config', 'ResourceTab', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
//$this->success('更新成功', U('index'));
} else {
$this->error('更新失敗');
}
} else {
$this->error($DataModel->getError());
}
} else {
$info = array();
/* 獲取數據 */
$info = $DataModel->getValue($id);
if (false === $info) {
$this->error('獲取配置信息錯誤');
}
$this->assign('info', $info);
$this->meta_title = '編輯配置';
$this->display();
}
}
示例14: index
/**
* 訂單管理
* author 煙消雲散 <1010422715@qq.com>
*/
public function index()
{
/* 查詢條件初始化 */
$status = $_GET['status'];
if (isset($_GET['status'])) {
switch ($status) {
case '1':
$map['status'] = $status;
$meta_title = "未使用快遞管理";
break;
case '2':
$map['status'] = $status;
$meta_title = "已使用快遞管理";
break;
}
} else {
$status = '';
$meta_title = "快遞管理";
}
if (isset($_GET['time-start'])) {
$map['update_time'][] = array('egt', strtotime(I('time-start')));
}
if (isset($_GET['time-end'])) {
$map['update_time'][] = array('elt', 24 * 60 * 60 + strtotime(I('time-end')));
}
$this->assign('status', $status);
$this->meta_title = $meta_title;
$list = $this->lists('Express', $map, 'id desc');
$this->assign('list', $list);
// 記錄當前列表頁的cookie
Cookie('__forward__', $_SERVER['REQUEST_URI']);
$this->display();
}
示例15: index
/**
* 短信管理列表
* @author 麥當苗兒 <zuojiazi@vip.qq.com>
*/
public function index()
{
$status = $_GET['status'];
if (isset($_GET['status'])) {
switch ($status) {
case '1':
$map['status'] = $status;
$meta_title = "日誌管理";
break;
}
} else {
$status = 1;
$map = array('status' => 1);
$meta_title = "日誌管理";
}
if (isset($_GET['title'])) {
$map['title'] = array('like', '%' . (string) I('title') . '%');
}
if (isset($_GET['time-start'])) {
$map['update_time'][] = array('egt', strtotime(I('time-start')));
}
if (isset($_GET['time-end'])) {
$map['update_time'][] = array('elt', 24 * 60 * 60 + strtotime(I('time-end')));
}
if (isset($_GET['nickname'])) {
$map['uid'] = M('Member')->where(array('nickname' => I('nickname')))->getField('uid');
}
$this->meta_title = $meta_title;
$this->assign('status', $status);
$list = $this->lists('UserLog', $map, 'id desc');
$this->assign('list', $list);
// 記錄當前列表頁的cookie
Cookie('__forward__', $_SERVER['REQUEST_URI']);
$this->display();
}