当前位置: 首页>>代码示例>>PHP>>正文


PHP Storage::add方法代码示例

本文整理汇总了PHP中Storage::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::add方法的具体用法?PHP Storage::add怎么用?PHP Storage::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Storage的用法示例。


在下文中一共展示了Storage::add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSerialize

 /**
  * Serialize/Unserialize testing
  */
 public function testSerialize()
 {
     $storage = new Storage();
     $alphabet = new Alphabet('en', array(), array(), array());
     $storage->add($alphabet);
     $serialized = serialize($storage);
     $this->assertEquals($storage, unserialize($serialized));
 }
开发者ID:jackblackjack,项目名称:LanguageDetector,代码行数:11,代码来源:StorageTest.php

示例2: array

if (!isset($_SESSION['WEB_SERFER'])) {
    $_SESSION['WEB_SERFER'] = array("IP" => $_SERVER["REMOTE_ADDR"], "BROWSER" => $_SERVER["HTTP_USER_AGENT"], "WEB_ID" => md5(GetRandom(8) . $_SERVER["REMOTE_ADDR"]));
}
$_SESSION['WEB_SERFER']["LAST_ACTIVITY"] = time();
$USER = App::USER();
$bIsAdmin = $USER->IsAdmin();
Storage::add("USER", $USER);
// [Рудименты]
if (Storage::exists("APP_TEMPLATE")) {
    App::get()->templateName = Storage::get("APP_TEMPLATE");
}
if (!Storage::exists("SITE_NAME")) {
    Storage::add("SITE_NAME", "");
}
if (!Storage::exists("SITE_DESCRIPTION")) {
    Storage::add("SITE_DESCRIPTION", "");
}
App::get()->setTitle(Storage::get()->SITE_NAME);
App::get()->setDescr(Storage::get()->SITE_DESCRIPTION);
// [/Рудименты]
// Задаем тип отображения для сессии
if (@isset($_REQUEST["sacid_display_mode"]) && $bIsAdmin) {
    switch (strtoupper($_REQUEST["sacid_display_mode"])) {
        case 'EDIT':
            $_SESSION['SACID_DISPLAY_MODE'] = 'EDIT';
            break;
        case 'NORMAL':
        default:
            $_SESSION['SACID_DISPLAY_MODE'] = 'NORMAL';
            break;
    }
开发者ID:r3c130n,项目名称:scriptacid,代码行数:31,代码来源:application.php

示例3: Storage

<?php

require_once 'Storage.php';
$storage = new Storage('differ', 'localhost', 'root', '');
$method = $_SERVER['REQUEST_METHOD'];
if ($method === 'POST') {
    $text1 = filter_var($_POST['text1'], FILTER_SANITIZE_STRING);
    $text2 = filter_var($_POST['text2'], FILTER_SANITIZE_STRING);
    $title = filter_var($_POST['title'], FILTER_SANITIZE_STRING);
    $storage->add(array($text1, $text2, $title));
    ##id holen
    $daten = $storage->last_id();
    header("Location: http://localhost/Differ2/result.php?id={$daten}");
    // header("Location: db.f4.htw-berlin.de/Aufgaeb4/result.php?id=$daten");
    exit;
}
?>


<!DOCTYPE html>
<html lang="de">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Differ_Textvergleich</title>

    <link href="./stylesheet.css" rel="stylesheet" media="screen">
  </head>

  <body>
开发者ID:elsabuchholz,项目名称:WebTeck,代码行数:31,代码来源:index.php

示例4: respond

            respond($storage->get($id));
        } else {
            respond($storage->all());
        }
        break;
    case 'PUT':
    case 'POST':
        $json = json_decode(file_get_contents('php://input'), true);
        $name = filter_var($json['name'], FILTER_SANITIZE_STRING);
        $url = filter_var($json['url'], FILTER_SANITIZE_URL);
        $image = filter_var($json['image'], FILTER_SANITIZE_URL);
        $price = filter_var($json['price'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND);
        if ($id && $storage->get($id)) {
            respond($storage->edit(array($name, $url, $image, $price, $id)));
        } else {
            respond($storage->add(array($name, $url, $image, $price)), 201);
        }
        break;
    case 'DELETE':
        if ($id && $storage->get($id)) {
            respond($storage->delete($id));
        } else {
            respond(false, 404);
        }
        break;
    default:
        header('Allow: GET, POST, PUT, DELETE', true, 405);
}
function respond($data, $status = 200)
{
    header('Content-Type: application/json', true, $status);
开发者ID:rezapurnamaa,项目名称:Products-JSON-Template,代码行数:31,代码来源:index.php

示例5: define

define('DEBUG_MODE', false);
// Загружать ли все классы модулей и классы в папке lib сразу или использовать __autoload.
define('DIRECT_LOAD_CLASSES', false);
define('CACHE_DATA_ENABLED', false);
define('CACHE_HTML_ENABLED', false);
// Need only for ScriptAcid API developers.
// {{{
define('_LIB_LOAD_DEBUG', false);
//Default site's template folder name
define('_DEFAULT_APPLICATION_TEMPLATE', '_default');
define('_DEFAULT_APPLICATION_TEMPLATE_SKIN', 'default');
define('_APP_DEFAULT_COMPONENT_CLASS', __NAMESPACE__ . '\\Component');
define('_DEFAULT_COMPONENT_TEMPLATE', '_default');
define('_DEFAULT_COMPONENT_TEMPLATE_SKIN', 'default');
define('_DEFAULT_COMPONENT_NAMESPACE', 'system');
// }}}
// This is an information about site.
// TODO: remove from config into the site definition logic
// {{{
Storage::add('SITE_NAME', 'scriptacid');
Storage::add('SITE_DESCRIPTION', 'Супер пупер scriptacid сайтег');
// TODO: сделать в админке свой шаблон.
// Пока так: если мы в админке - используем шаблон main
if (substr($_SERVER['REQUEST_URI'], 0, 14) == '/scriptacid/admin/') {
    Storage::add('APP_TEMPLATE', 'main');
} else {
    Storage::add('APP_TEMPLATE', '_default');
}
// Определяем язык и шаблон
define('LANG_ID', 'ru');
// }}}
开发者ID:r3c130n,项目名称:scriptacid,代码行数:31,代码来源:config.example.php

示例6: microtime

<?php

namespace ScriptAcid;

$startPageTime = microtime(true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/kernel.php";
Storage::add("startPageTime", $startPageTime);
App::get()->makePage(function (&$arPageParams) {
    ?>


<script type="text/javascript">
$(document).ready(function() {
	//$('#tszh-edit-form').hide();
	$('a#tszh-add-button').click(function() {
		$('#tszh-edit-form').toggle("slow");
		return false;
	});
	<?php 
    if ($_GET["ACTION"] != "EDIT" || intval($_GET["ID"]) == 0) {
        ?>
	$('#tszh-edit-form').toggle("fast");
	<?php 
    }
    ?>
});
</script>
<a href="#" id="tszh-add-button">Добавить новое ТСЖ</a>


<p><?php 
开发者ID:r3c130n,项目名称:scriptacid,代码行数:31,代码来源:index.php


注:本文中的Storage::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。