Wallogit.com
2017 © Pedro Peláez
rand support in laravel 5
composer require yuxiaoyang/rander
或者在你的 composer.json 的 require 部分中添加:, (*1)
"yuxiaoyang/rander": "~1.0"
下载完毕之后,直接配置 config/app.php 的 providers:, (*2)
//Illuminate\Hashing\HashServiceProvider::class, Yuxiaoyang\Rander\RanderProvider::class,
控制器中使用 IndexController.php :, (*3)
```php, (*4)
<?php, (*5)
use \Yuxiaoyang\Rander\Rander;, (*6)
class IndexController extends Controller { public $rand;, (*7)
public function index(Request $request)
{
//$this->rand = new \Yuxiaoyang\Rander\Rander();
$this->rand = new Rander();
//make($num) $num为需要生成的字符串长度
echo $this->rand->make(5);
}
}, (*8)