本文整理汇总了PHP中functions::hash方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::hash方法的具体用法?PHP functions::hash怎么用?PHP functions::hash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::hash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($params)
{
$file = 'console-' . date(@$params['log'] ?: 'Y-m-d') . '.log';
$this->_file = \loader::get_temp($file);
$this->_uid = substr(\functions::hash(microtime(true)), -5);
$this->_head();
}
示例2: _hash
/**
* Gets some hash
*/
private function _hash($what)
{
return functions::hash($what);
}
示例3: make_key
/**
* Make session key
*/
function make_key()
{
$key = $this->salt;
if ($this->with_browser) {
$key .= isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
}
if ($this->ip_octets && isset($_SERVER['REMOTE_ADDR'])) {
$num_blocks = $this->ip_octets > 4 ? $this->ip_octets : 4;
$blocks = explode('.', $_SERVER['REMOTE_ADDR']);
for ($i = 0; $i < $num_blocks; $i++) {
$key .= $blocks[$i] . '.';
}
}
return functions::hash($key);
}
示例4: remove_after
$nodes = $sat->get_news_handle();
$sid = $nodes->make_attach_sid();
$id = $nodes->create(['title' => 'Hello', 'attach_sid' => $sid]);
$node = $nodes->get_last_item();
// attach
/** @var SatCMS\Modules\Sat\Classes\Behaviors\ImageAttachs $imagesBehavior */
$imagesBehavior = $node->behavior('Sat.ImageAttachs');
$imageAttachs = $imagesBehavior->get_attachs();
$imageAttachs->create(['pid' => $id, 'title' => $node->id . '|' . functions::hash(microtime(1)), 'ctype_id' => $node->get_ctype_id()]);
class testBehavior extends model_behavior
{
function remove_after()
{
test_assert(!$this->model->behavior('Sat.ImageAttachs')->get_attachs()->count());
}
}
$node->add_behavior('test.behavior', new testBehavior());
/** @var SatCMS\Modules\Sat\Classes\Behaviors\Commentable $commentsBehavior */
$commentsBehavior = $node->behavior('Sat.Commentable');
$commentAttachs = $commentsBehavior->get_attachs();
for ($i = 0; $i <= 5; $i++) {
$commentAttachs->create(['pid' => $id, 'comment' => $node->id . '|' . functions::hash(microtime(1)), 'ctype_id' => $node->get_ctype_id()]);
}
$node->remove();
$node = $nodes->load_only_id($id);
test_assert($imagesBehavior->get_attachs()->count() == 0);
$node = $nodes->get_last_item();
test_assert(!$node);
$node = $nodes->alloc();
$node->title = 'Привет Мир';
$node->save();