php laravel加密 form表单认证 laravel分页

use Illuminate\Support\Facades\Crypt;
echo Crypt::encrypt(123);  //加密
echo "<br>";
//解密
echo Crypt::decrypt("eyJpdiI6InpCcGdBK0JQajJ3c01wSVh2QVVPWmc9PSIsInZhbHVlIjoic3JRSXVTSUpIUTZER0ZVazVKV0t0QT09IiwibWFjIjoiZDllMzFlMzI1NDlhNWVjYzBkMmI0M2FkYzUzZmZjZjI0NThlMmY3NWVlNTc2YzYyNmZlMjMzMmI1ZjMzYTZlNCJ9"); //PHP form 表单认证
后端:
$input=$request->all();
$rules=[
'username'=>"required|unique:User|between:6,12", //required是否为空 unique是否存在 between 长度
"passwd"=>"required|between:6,12|same:repasswd" //same 是否和repasswd密码一样
];
$message=array(
"username.required"=>"请输入用户名",
"username.unique"=>"用户名已存在",
"username.between"=>"用户名长度不满足",
"passwd.required"=>"请输密码",
"passwd.between"=>"用户名长度不满足",
   "passwd.same"=>"密码不一样",

);
$validator = \Validator::make($input,$rules,$message); if($validator->passes()){
echo 123; }else{
return back()->withInput()->withErrors($validator); 前端:
@if(count($errors) >0)

    <div>
@foreach($errors->all() as $error)
<li>{{$error}}</li>
@endforeach
</div> @endif //php laravel分页 两种分页 第一种比较好
$aa=DB::table("User")->orderBy("id","desc")->paginate(3); 
$aa=DB::table("User")->orderBy("id","desc")->simplePaginate(3);

上一篇:setPreferredContentSize error in ios app


下一篇:Laravel 分页详解