本文整理汇总了PHP中State::get方法的典型用法代码示例。如果您正苦于以下问题:PHP State::get方法的具体用法?PHP State::get怎么用?PHP State::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stateShouldKeepItemsByRuleNumberAndPosition
/**
* @test
*/
public function stateShouldKeepItemsByRuleNumberAndPosition()
{
$item1 = new Item(new Rule(1, 'E', array('E', '+', 'T')), 0);
$state = new State(0, array($item1));
$this->assertSame($item1, $state->get(1, 0));
$item2 = new Item(new Rule(2, 'T', array('T', '+', 'F')), 0);
$state->add($item2);
$this->assertSame($item2, $state->get(2, 0));
}
示例2: load_states
public function load_states()
{
$country_id = $_POST['country_id'];
$states = new State();
if ($country_id > 0) {
$states->where('country_id', $country_id);
}
$states->get();
echo '<select name="state_id" class="form-control">';
echo '<option value="">-- select state --</option>';
foreach ($states as $key => $state_item) {
echo '<option value="' . $state_item->id . '">' . $state_item->state_name . '</option>';
}
echo '</select>';
}
示例3: notify
/**
* Register a notification.
*
* @param string $message The message to print.
* @param string $type The type of notification [self::ERROR|self::SUCCESS|self::INFO].
*/
static function notify($message, $type)
{
$nots = State::get('notifications');
array_push($nots, array('message' => $message, 'type' => $type));
State::set('notifications', $nots);
}
示例4: update
/**
* Save/reset/load component values.
*/
private function update()
{
$errors = array();
switch (State::get('action')) {
case 'save':
$errors = $this->save();
Notifier::success('Settings saved.');
break;
case 'reset-section':
$section = $this->config->get_section_by_slug(State::get('active_section'));
$this->reset($section);
Notifier::success('<strong>' . $section->title . '</strong> section was reset to its default settings.');
break;
case 'reset-all':
$this->reset();
Notifier::success('All sections were reset to their default settings.');
break;
// No submission (simple request)
// No submission (simple request)
default:
$this->load();
}
$this->set_errors($errors);
}
示例5:
<!DOCTYPE html>
<html lang="es"><head>
<title><?php
echo State::get('title');
?>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="<?php
echo Settings::host();
?>
lib/stys/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?php
echo Settings::host();
?>
lib/stys/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<?php
echo Settings::host();
?>
lib/stys/global.css">
<script type="text/javascript" src="<?php
echo Settings::host();
?>
lib/scrs/jquery.min.js"></script>
<script type="text/javascript" src="<?php
echo Settings::host();
?>
lib/scrs/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php
echo Settings::host();
示例6: Rating
$request = \Slim\Slim::getInstance()->request();
$rating = json_decode($request->getBody());
$ratingDAO = new Rating();
$ratingDAO->update($rating);
echo '{"result":"ok"}';
});
$app->delete('/rating', function () {
$request = \Slim\Slim::getInstance()->request();
$rating = json_decode($request->getBody());
$ratingDAO = new Rating();
$ratingDAO->delete($rating);
echo '{"result":"ok"}';
});
$app->get('/state', function () {
$stateDAO = new State();
$result = $stateDAO->get();
echo json_encode($result);
});
$app->post('/state', function () {
$request = \Slim\Slim::getInstance()->request();
$state = json_decode($request->getBody());
$stateDAO = new State();
$stateDAO->insert($state);
echo '{"result":"ok"}';
});
$app->put('/state', function () {
$request = \Slim\Slim::getInstance()->request();
$state = json_decode($request->getBody());
$stateDAO = new State();
$stateDAO->update($state);
echo '{"result":"ok"}';