本文整理汇总了PHP中Random::generateID方法的典型用法代码示例。如果您正苦于以下问题:PHP Random::generateID方法的具体用法?PHP Random::generateID怎么用?PHP Random::generateID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Random
的用法示例。
在下文中一共展示了Random::generateID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savePOSTData
/**
* Save the given HTTP POST data and the destination where it should be posted to a given session.
*
* @param \SimpleSAML_Session $session The session where to temporarily store the data.
* @param string $destination The destination URL where the form should be posted.
* @param array $data An associative array with the data to be posted to $destination.
*
* @return string A random identifier that can be used to retrieve the data from the current session.
*
* @author Andjelko Horvat
* @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no>
*/
private static function savePOSTData(\SimpleSAML_Session $session, $destination, $data)
{
// generate a random ID to avoid replay attacks
$id = Random::generateID();
$postData = array('post' => $data, 'url' => $destination);
// save the post data to the session, tied to the random ID
$session->setData('core_postdatalink', $id, $postData);
return $id;
}