Laravel中uuid的使用

使用Webpatser

1.下载扩展包
composer require webpatser/laravel-uuid
2.修改config/app.php配置文件,在aliases处添加下面的代码
'UUID' => Webpatser\Uuid\Uuid::class,
3.使用uuid
use Webpatser\Uuid\Uuid;
UUID::generate();

使用Ramsey

直接使用即可
use Ramsey\Uuid\Uuid;

Uuid::uuid1()->getHex();

猜你喜欢

转载自blog.csdn.net/touxian51552/article/details/88577199