本文整理汇总了PHP中Hash::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Hash::set方法的具体用法?PHP Hash::set怎么用?PHP Hash::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hash
的用法示例。
在下文中一共展示了Hash::set方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setLabel
/**
* Add a label
*
* @return void
* @author Justin Palmer
**/
public static function setLabel($key, $value)
{
if (!self::$Labels instanceof Hash) {
self::$Labels = new Hash();
}
self::$Labels->set($key, $value);
}
示例2: send
/**
* Send email $to with using the $template file in the
* /app/view/email/ directory otherwise you changed {@link $viewDir}
* @param $to
* @param string $template Filename of template to use
* @param string $subject Optional alternate subject that should be used
* @param array(string) $data optional additional associated array data to render in the view
* @return boolean true if mail was successfully send, otherwise false
*/
public function send($to, $template, $subject = null, $data = array())
{
// use user logged in email for reply adress
if ($this->controller->UserLogin->loggedin()) {
$this->headers->set('Reply-To', $this->controller->UserLogin->User->get('email'));
$this->headers->set('From', $this->controller->UserLogin->User->get('email'));
}
// render content
$view = Library::create('ephFrame.lib.view.View', array($this->viewDir, $template, array_merge($this->controller->data->toArray(), $data)));
$view->theme = $this->controller->theme;
// send mail and return result
return @mail($to, $subject == null ? $this->subject : $subject, $view->render(), $this->headers->implodef(RTLF, '%s: %s'));
}
示例3: rule
/**
* Add a rule to a column
*
* @return void
* @author Justin Palmer
**/
public function rule($column, Rule $rule)
{
//Make sure the property exists.
$this->model->hasProperty($column);
if ($rule instanceof RequiredRule) {
$this->required[] = $column;
}
//Get the rules for this property.
$rules = $this->rules->get($column);
if ($rules === null) {
$rules = array();
}
$rules[] = $rule;
$this->rules->set($column, $rules);
}
示例4: decodeHash
public function decodeHash()
{
$h = new Hash();
$this->nextToken();
$this->skipBlanks();
if ($this->c === 125) {
$this->nextToken();
return $h;
}
while ($this->c !== 125) {
$key = $this->decodeString();
$this->skipBlanks();
if ($this->c !== 58) {
throw new HException("Expected ':'.");
}
$this->nextToken();
$this->skipBlanks();
$o = $this->localDecode();
$h->set($key, $o);
$this->skipBlanks();
if ($this->c === 44) {
$this->nextToken();
$this->skipBlanks();
} else {
if ($this->c !== 125) {
throw new HException("Expected ',' or '}'. " . $this->getPositionRepresentation());
}
}
unset($o, $key);
}
$this->nextToken();
return $h;
}
示例5: __set
/**
* __set vars
*
* @return void
* @author Justin Palmer
**/
public function __set($key, $value)
{
if (!$this->columns()->isKey($key)) {
throw new NoColumnInTableException($key, $this->table_name());
}
$this->props_changed[] = $key;
$this->props->set($key, $value);
}
示例6: hashOfAssociativeArray
static function hashOfAssociativeArray($arr)
{
$h = new Hash();
reset($arr);
while (list($k, $v) = each($arr)) {
$h->set($k, $v);
}
return $h;
}
示例7: fromProperties
static function fromProperties($prop)
{
$ht = new Hash();
$key = "";
$value = "";
foreach ($prop as $key => $value) {
$ht->set($key, $value);
}
return $ht;
}
示例8: computeInverse
static function computeInverse($dict)
{
$keys = $dict->keys();
$outDict = new Hash();
while ($keys->hasNext()) {
$key = $keys->next();
$outDict->set($dict->get($key), $key);
unset($key);
}
return $outDict;
}
示例9: key
public function key()
{
$reg = "^";
$chars = _hx_explode("", $this->str);
$ch = "";
$inKey = false;
$keyName = "";
$matchIndex = 0;
$keys = new Hash();
while (($ch = $chars->shift()) !== null) {
if ($ch == ":") {
$matchIndex++;
$keyName = "";
$inKey = true;
} else {
if ($inKey && _hx_deref(new EReg("[^a-z]", "i"))->match($ch)) {
$inKey = false;
$keys->set($keyName, $matchIndex);
$reg .= "([a-zA-Z0-9]+)" . $this->escape($ch);
} else {
if ($inKey) {
$keyName .= $ch;
} else {
$reg .= $this->escape($ch);
}
}
}
}
if ($inKey) {
$keys->set($keyName, $matchIndex);
$reg .= "([a-zA-Z0-9]+)";
}
$reg .= "\$";
haxe_Log::trace("(key) From pattern: " . $this->str . " we created expression: " . $reg . " and found these keys: " . $keys, _hx_anonymous(array("fileName" => "Route.hx", "lineNumber" => 144, "className" => "sinatra.RouteParser", "methodName" => "key")));
return new EReg($reg, "");
}
示例10: Hash
function __construct(Controller $controller)
{
$this->controller = $controller;
$filters = new Hash();
$filters->set(self::before, new Hash());
$filters->set($this->exceptName(self::before), new Hash());
$filters->set(self::around, new Hash());
$filters->set($this->exceptName(self::around), new Hash());
$filters->set(self::after, new Hash());
$filters->set($this->exceptName(self::after), new Hash());
$this->filters = $filters;
}
示例11: computeDigest
public function computeDigest($mml, $param)
{
$ss = $this->getEditorParametersList();
$i = null;
$renderParams = new Hash();
$_g1 = 0;
$_g = $ss->length;
while ($_g1 < $_g) {
$i1 = $_g1++;
$key = $ss[$i1];
$value = com_wiris_system_PropertiesTools::getProperty($param, $key, null);
if ($value !== null) {
$renderParams->set($key, $value);
}
unset($value, $key, $i1);
}
if ($mml !== null) {
$renderParams->set("mml", $mml);
}
$s = com_wiris_util_sys_IniFile::propertiesToString($renderParams);
return $this->plugin->getStorageAndCache()->codeDigest($s);
}
示例12: getMultipart
static function getMultipart($maxSize)
{
$h = new Hash();
$buf = null;
$curname = null;
php_Web::parseMultipart(array(new _hx_lambda(array(&$buf, &$curname, &$h, &$maxSize), "php_Web_1"), 'execute'), array(new _hx_lambda(array(&$buf, &$curname, &$h, &$maxSize), "php_Web_2"), 'execute'));
if ($curname !== null) {
$h->set($curname, $buf->b);
}
return $h;
}
示例13: getMultipart
static function getMultipart($maxSize)
{
$h = new Hash();
$buf = null;
$curname = null;
php_Web::parseMultipart(array(new _hx_lambda(array("buf" => &$buf, "curname" => &$curname, "h" => &$h, "maxSize" => &$maxSize), null, array('p', '_'), "{\n\t\t\tif(\$curname !== null) {\n\t\t\t\t\$h->set(\$curname, \$buf->b);\n\t\t\t}\n\t\t\t\$curname = \$p;\n\t\t\t\$buf = new StringBuf();\n\t\t\t\$maxSize -= strlen(\$p);\n\t\t\tif(\$maxSize < 0) {\n\t\t\t\tthrow new HException(\"Maximum size reached\");\n\t\t\t}\n\t\t}"), 'execute2'), array(new _hx_lambda(array("buf" => &$buf, "curname" => &$curname, "h" => &$h, "maxSize" => &$maxSize), null, array('str', 'pos', 'len'), "{\n\t\t\t\$maxSize -= \$len;\n\t\t\tif(\$maxSize < 0) {\n\t\t\t\tthrow new HException(\"Maximum size reached\");\n\t\t\t}\n\t\t\t\$buf->b .= _hx_substr(\$str, \$pos, \$len);\n\t\t}"), 'execute3'));
if ($curname !== null) {
$h->set($curname, $buf->b);
}
return $h;
}