加密
<?php/*** 密码入库加密* @param string $password* @return string** */public function passwordEncrypt($password){ return app('hash')->make($password);}密码验证
<?php/*** 密码验证* @param string $password* @param string $hashedPassword 加密后的密码* @return bool** */public function passwordValidate($password, $hashedPassword){ return app('hash')->check($password, $hashedPassword);}如果使用 Eloquent 的 Query Scopes,查询时使用链式方法调用,通常是这么查询, $modelObj = Model::id($id)->get()来查询指定条件的结果集。但是这么查出来的,实际上返回的是 Illuminate\Support\Collection对象。那么下面的方法,比较适合判断查出来的结果是否存在。
<?php$modelObj = Model::id($id)->get();if (! $modelObj->isEmpty()) { $modelObj->toArray();}// 或者这样if ($modelObj->count()) { $modelObj->toArray();}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号