Beispiel #1
0
 /**
  * 测试[Text::random]
  */
 public function testRandom()
 {
     $str = Text::random(10);
     //echo ' ' . $str . ' ';
     $this->assertEquals(10, Text::length($str));
     $str = Text::random(3, 'q');
     //echo ' ' . $str . ' ';
     $this->assertEquals('qqq', $str);
 }
Beispiel #2
0
 /**
  * 生成一个随机会话ID
  *
  * @return string
  */
 public static function generateSession()
 {
     $sessionID = TextHelper::random(20, 'qwertyuiopasdfghjklzxcvbnm1234567890');
     Base::getLog()->debug(__METHOD__ . ' generate session id', ['id' => $sessionID]);
     return $sessionID;
 }