當前位置: 首頁>>代碼示例>>PHP>>正文


PHP State::get方法代碼示例

本文整理匯總了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));
 }
開發者ID:MPV,項目名稱:AspectMock-test,代碼行數:12,代碼來源:StateTest.php

示例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>';
 }
開發者ID:ultraauchz,項目名稱:asean_cultural_mapping,代碼行數:15,代碼來源:states.php

示例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);
 }
開發者ID:Air-Craft,項目名稱:air-craft-www,代碼行數:12,代碼來源:Notifier.php

示例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);
 }
開發者ID:Air-Craft,項目名稱:air-craft-www,代碼行數:27,代碼來源:OptionsPage.php

示例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();
開發者ID:samueleishion,項目名稱:TLLL,代碼行數:31,代碼來源:header.php

示例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"}';
開發者ID:,項目名稱:,代碼行數:31,代碼來源:


注:本文中的State::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。