You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
842 B
35 lines
842 B
<?php
|
|
|
|
namespace console\controllers;
|
|
|
|
use Yii;
|
|
use yii\console\Controller;
|
|
use yii\helpers\Console;
|
|
|
|
/**
|
|
* Description of RbacsetController
|
|
*
|
|
* @author blobt
|
|
*/
|
|
class TestController extends Controller {
|
|
|
|
public function actionIndex() {
|
|
//Yii::$aa->security->generateRandomString(8);
|
|
$security = Yii::createObject("yii\base\Security");
|
|
$n = 0;
|
|
for ($i = 1; $i < 1000; $i++) {
|
|
//$key = $security->generateRandomString(8);
|
|
$key = rand(10000000, 99999999);
|
|
//$key = strtolower($key);
|
|
//$key = str_replace(['_', '-'], 'a', $key);
|
|
$ret[$key] += 1;
|
|
}
|
|
|
|
$this->stdout("duplicate data:\n", Console::FG_RED);
|
|
foreach ($ret as $k => $v) {
|
|
if ($v > 1) {
|
|
echo "$k $v\n";
|
|
}
|
|
}
|
|
}
|
|
}
|