本文整理汇总了PHP中CSession::unsetValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CSession::unsetValue方法的具体用法?PHP CSession::unsetValue怎么用?PHP CSession::unsetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSession
的用法示例。
在下文中一共展示了CSession::unsetValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doAction
protected function doAction()
{
$data = ['theme' => getUserTheme(CWebUser::$data), 'messages' => []];
if (CSession::keyExists('messages')) {
$data['messages'] = CSession::getValue('messages');
CSession::unsetValue(['messages']);
}
$this->setResponse(new CControllerResponseData($data));
}
示例2: local_showMessage
function local_showMessage()
{
global $ZBX_MESSAGES;
if (CSession::keyExists('messageOk') || CSession::keyExists('messageError')) {
if (CSession::keyExists('messages')) {
$ZBX_MESSAGES = CSession::getValue('messages');
CSession::unsetValue(['messages']);
}
if (CSession::keyExists('messageOk')) {
show_messages(true, CSession::getValue('messageOk'));
} else {
show_messages(false, null, CSession::getValue('messageError'));
}
CSession::unsetValue(['messageOk', 'messageError']);
}
}
示例3: CView
$message_error = null;
$messages = [];
// this code show messages generated by MVC pages
if (CSession::keyExists('messageOk') || CSession::keyExists('messageError')) {
if (CSession::keyExists('messages')) {
$messages = CSession::getValue('messages');
CSession::unsetValue(['messages']);
}
if (CSession::keyExists('messageOk')) {
$message_good = true;
$message_ok = CSession::getValue('messageOk');
} else {
$message_good = false;
$message_error = CSession::getValue('messageError');
}
CSession::unsetValue(['messageOk', 'messageError']);
}
if (!defined('ZBX_PAGE_NO_MENU')) {
$pageMenu = new CView('layout.htmlpage.menu', ['server_name' => isset($ZBX_SERVER_NAME) ? $ZBX_SERVER_NAME : '', 'menu' => ['main_menu' => $main_menu, 'sub_menus' => $sub_menus, 'selected' => $page['menu']], 'user' => ['is_guest' => CWebUser::isGuest(), 'alias' => CWebUser::$data['alias'], 'name' => CWebUser::$data['name'], 'surname' => CWebUser::$data['surname']]]);
echo $pageMenu->getOutput();
}
if ($page['type'] == PAGE_TYPE_HTML) {
echo '<div class="' . ZBX_STYLE_ARTICLE . '">';
}
// unset multiple variables
unset($table, $top_page_row, $menu_table, $main_menu_row, $sub_menu_table, $sub_menu_rows);
if ($page['type'] == PAGE_TYPE_HTML && $showGuiMessaging) {
zbx_add_post_js('initMessages({});');
}
// if a user logs in after several unsuccessful attempts, display a warning
if ($failedAttempts = CProfile::get('web.login.attempt.failed', 0)) {
示例4: validateInput
/**
* Validate input parameters.
*
* @return var
*/
public function validateInput($validationRules)
{
if (CSession::keyExists('formData')) {
$input = array_merge($_REQUEST, CSession::getValue('formData'));
CSession::unsetValue(['formData']);
} else {
$input = $_REQUEST;
}
$validator = new CNewValidator($input, $validationRules);
foreach ($validator->getAllErrors() as $error) {
info($error);
}
if ($validator->isErrorFatal()) {
$this->validationResult = self::VALIDATION_FATAL_ERROR;
} else {
if ($validator->isError()) {
$this->input = $validator->getValidInput();
$this->validationResult = self::VALIDATION_ERROR;
} else {
$this->input = $validator->getValidInput();
$this->validationResult = self::VALIDATION_OK;
}
}
return $this->validationResult == self::VALIDATION_OK;
}