企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 第十七课 密码安全 做登录验证,自动加盐,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> ``` ```