session_id = session_id(); // 当前的 session_id define('SESSION_ID',$this->session_id); //将当前的session_id保存为常量,供其它方法调用 // 判断当前用户是否手机 if(isMobile()) cookie('is_mobile','1',3600); else cookie('is_mobile','0',3600); $this->request->isAjax() ? define('IS_AJAX',true) : define('IS_AJAX',false); // ($this->request->method() == 'GET') ? define('IS_GET',true) : define('IS_GET',false); // ($this->request->method() == 'POST') ? define('IS_POST',true) : define('IS_POST',false); // define('MODULE_NAME',$this->request->module()); // 当前模块名称是 define('CONTROLLER_NAME',$this->request->controller()); // 当前控制器名称 define('ACTION_NAME',$this->request->action()); // 当前操作名称是 $this->public_assign(); } /** * 保存公告变量到 smarty中 比如 导航 */ public function public_assign() { $tpshop_config = array(); $tp_config = M('config')->cache(true,TPSHOP_CACHE_TIME)->select(); $this->assign('tpshop_config', $tpshop_config); } /* * */ public function ajaxReturn($data){ exit(json_encode($data)); } }