🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 第十七课 密码安全 做登录验证,自动加盐,php5.5+ ``` <pre class="calibre16">``` $pass <span class="token">=</span> <span class="token1">password_hash</span><span class="token2">(</span><span class="token4">"123456"</span><span class="token2">,</span>PASSWORD_DEFAULT<span class="token2">)</span><span class="token2">;</span> <span class="token5">if</span><span class="token2">(</span><span class="token1">password_verify</span><span class="token2">(</span><span class="token4">"123456"</span><span class="token2">,</span>$pass<span class="token2">)</span><span class="token2">)</span><span class="token2">{</span> <span class="token1">dump</span><span class="token2">(</span><span class="token4">"密码正确"</span><span class="token2">)</span><span class="token2">;</span> <span class="token2">}</span><span class="token5">else</span><span class="token2">{</span> <span class="token1">dump</span><span class="token2">(</span><span class="token4">"密码错误"</span><span class="token2">)</span><span class="token2">;</span> <span class="token2">}</span> ``` ```