ThinkPHP3.2.2实现持久登录(记住我)功能的方法

前端之家收集整理的这篇文章主要介绍了ThinkPHP3.2.2实现持久登录(记住我)功能的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文实例讲述了ThinkPHP3.2.2实现持久登录功能方法分享给大家供大家参考,具体如下:

实现持久登录,即用户登录时,勾选了"记住我"之后,无论是否关闭浏览器,只要不退出登录,在指定的时间内始终保持登录状态(缺点是在另一台电脑上登录过后,之前那台电脑就不能继续保持登录状态)。

首先,持久登陆使用 cookie 实现,但是 cookie 中不能保存用户密码这样重要的信息,即使加密过。解决方案是在用户登录表中新建3个字段identifier:第二身份标识,token:永久登录标识,timeout:永久登录超时时间。

sql;"> +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | uid | int(11) | NO | PRI | NULL | auto_increment | | uname | varchar(20) | YES | | NULL | | | upwd | varchar(20) | YES | | NULL | | | uflag | int(11) | YES | | NULL | | | identifier | varchar(32) | YES | | NULL | | | token | varchar(32) | YES | | NULL | | | timeout | int(11) | YES | | NULL | | +------------+-------------+------+-----+---------+----------------+

用户勾选了"记住我"登录时,应该生成一个唯一的 identifier,一个唯一的 token,并且设置一个过期时间 timeout,把两个代表身份的值写入cookie,设置 cookie 过期时间为 timeout,例如:setcookie('auth',"$identifier:$token",$timeout); 同时把三个值插入数据表;当用户再一次访问网站时,首先判断 cookie 中是否含有 auth,如果含有,则去数据库中进行身份比对(identifier 和 token),比对成功时,把用户信息写入 session,同时用户保持登录状态。

代码

控制器 TestController.class.PHP

PHP;"> checkLong(); //已经登录跳转至个人中心 if(isset($_SESSION['username'])){ $this->redirect('Test/ucenter'); }else{ //判断是否存在cookie if(isset($_COOKIE['username'])){ $this->assign('username',$_COOKIE['username']); } //显示注册页 $this->display("test"); } } //显示验证码 public function verifyImg(){ $verify = new \Think\Verify(); //$verify->useZh = true; //使用中文验证码 $verify->length = 4; $verify->entry(); } //验证登录 public function check(){ $verify = new \Think\Verify(); if($verify->check(I("yzm"))){ //判断用户名密码 $user = new \Test\Model\TestModel(); $res = $user->checkName(I("username"),I("pwd")); if($res === false){ echo "用户名或密码错误"; }else{ //用户信息存入session session("username",$res['uname']); session("id",$res['uid']); //如果用户勾选了"记住我",则保持持久登陆 if(I("remember")){ $salt = $this->random_str(16); //第二分身标识 $identifier = md5($salt . md5(I("username") . $salt)); //永久登录标识 $token = md5(uniqid(rand(),true)); //永久登录超时时间(1周) $timeout = time()+3600*24*7; //存入cookie setcookie('auth',$timeout); $user->saveRemember($res['uid'],$identifier,$token,$timeout); } //把用户名存入cookie,退出登录后在表单保存用户名信息 setcookie('username',I('username'),time()+3600*24); //跳转至会员中心 $this->redirect('Test/ucenter'); } }else{ echo "输入错误"; } } //测试strstr函数 public function strstrtest(){ $param = "Think\Verify"; //第三个参数为true,返回'Think';没有第三个参数,返回'\Verify' $name = strstr($param,'\\',true); echo $name; } //用户中心 public function ucenter(){ //判断是否永久登录 $this->checkLong(); $this->assign("session",$_SESSION); $this->display("ucenter"); } //退出登录 public function loginout(){ session(null); setcookie('auth','',time()-1); $this->redirect("Test/login"); } //生成随机数,用于生成salt public function random_str($length){ //生成一个包含 大写英文字母,小写英文字母,数字 的数组 $arr = array_merge(range(0,9),range('a','z'),range('A','Z')); $str = ''; $arr_len = count($arr); for ($i = 0; $i < $length; $i++){ $rand = mt_rand(0,$arr_len-1); $str.=$arr[$rand]; } return $str; } //判断是否持久登录 public function checkLong(){ $check = new \Test\Model\TestModel(); $is_long = $check->checkRemember(); if($is_long === false){ }else{ session("username",$is_long['uname']); session("id",$is_long['uid']); } } }

模型 TestModel.class.PHP

PHP;"> getByUname($name); if($info != null){ //验证密码 if($info['upwd'] == $pwd){ return $info; }else{ return false; } }else{ return false; } } //当用户勾选"记住我" public function saveRemember($uid,$timeout){ $admin = M("admin"); $data['identifier'] = $identifier; $data['token'] = $token; $data['timeout'] = $timeout; $where = " uid = ".$uid; $res = $admin->data($data)->where($where)->save(); return $res; } //验证用户是否永久登录(记住我) public function checkRemember(){ $arr = array(); $now = time(); list($identifier,$token) = explode(':',$_COOKIE['auth']); if (ctype_alnum($identifier) && ctype_alnum($token)){ $arr['identifier'] = $identifier; $arr['token'] = $token; }else{ return false; } $admin = M("admin"); $info = $admin->getByidentifier($arr['identifier']); if($info != null){ if($arr['token'] != $info['token']){ return false; }else if($now > $info['timeout']){ return false; }else{ return $info; } }else{ return false; } } }

视图 登录页 test.html

<Meta charset="UTF-8"> Document
用户名" value="{$username}">
用户名">
Box" name="remember" id="remember">

视图 个人中心 ucenter.html

<Meta charset="UTF-8"> Documenttitle> </head> <body> <if condition="$session['username'] neq null"> <i>{$session.username},</i> <else /> <i>游客,</i> </if> 欢迎您<br> <a href="__CONTROLLER__/loginout">退出登录</a> </body> </html> </pre> </div> <p><h3>附:模块目录</h3></p> <p><img src="https://files.jb51.cc/file_images/article/201605/201651690900929.jpg?20164169919" /></p> <p><h3>补充:<span style="color: #ff6600">小编在这里推荐一款本站的php格式化美化的排版工具帮助大家在以后的PHP程序设计中进行代码排版: </h3></p> <p><h3><span style="color: #0000ff">php代码在线格式化美化工具:</h3><a target="_blank" href="http://tools.jb51.cc/code/phpformat">http://tools.jb51.cc/code/phpformat</a></p> <p>更多关于think<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>相关<a href="https://www.jb51.cc/tag/neirong/" target="_blank" class="keywords">内容</a>感兴趣的读者可查看本站专题:《<a target="_blank" href="//www.jb51.cc/Special/39.htm">ThinkPHP入门教程</a>》、《<a target="_blank" href="//www.jb51.cc/Special/129.htm">ThinkPHP常用方法总结</a>》、《<a target="_blank" href="//www.jb51.cc/Special/26.htm">smarty模板入门基础教程</a>》及《<a target="_blank" href="//www.jb51.cc/Special/350.htm">PHP模板技术总结</a>》。</p> <p>希望本文所述对大家基于Think<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>框架的<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>程序设计有所帮助。</p><i class="glyphicon glyphicon-link"></i> 原文链接:https://www.f2er.com/thinkphp/19753.html</div> <div class="topcard-tags"><a href="https://www.f2er.com/tag/ThinkPHPjiaocheng/" class="tag_link" target="_blank">ThinkPHP教程</a></div> <ul class="list-group"> <li class="list-group-item"><a href="https://www.f2er.com/thinkphp/19761.html" title="thinkphp框架下404页面设置 仅三步">上一篇:thinkphp框架下404页面设置 仅三步</a><a href="https://www.f2er.com/thinkphp/19751.html" title="ThinkPHP自定义Redis处理SESSION的实现方法" class="text-muted pull-right">下一篇:ThinkPHP自定义Redis处理SESSION的</a> </li> </ul> </div> </div> </div> <!-- row end --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4605373693034661" data-ad-slot="9144498553"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script></div> </div> </div> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <div class="title"><h1>猜你在找的ThinkPHP相关文章</h1></div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/997486.html" title="Thinkphp 缓存微信jssdk相关认证参数"><div class="title">Thinkphp 缓存微信jssdk相关认证参数</div> <div class="summary">public function getapiSignature(){$access_token=S(&#39;access_token&#39;);//...</div> <time class="summary">作者:前端之家 时间:2021-02-18</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/997485.html" title="用户登陆模块的后端实现"><img class="lazy" src="https://www.f2er.com/images/np.jpg" data-original="https://www.f2er.com/res/2021/02-18/10/51e409b11aa51c150090697429a953ed.gif" title="" width="160" height="90" style="float:right;margin-left:30px;display:none;" /><div class="title">用户登陆模块的后端实现</div> <div class="summary">前述两篇文章“使用BootStrap制作用户登录UI”和“使用BootStrapValidator来完成前端输入验...</div> <time class="summary">作者:前端之家 时间:2021-02-18</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/997484.html" title="在ThinkPHP3.x框架中实现将原创文章第一时间推送到百度收录"><div class="title">在ThinkPHP3.x框架中实现将原创文章第一时间推送到百度收录</div> <div class="summary">前两天自己写的一篇文章“针对BootStrap中tabs控件的美化和完善”被别的网站给转载了,这也...</div> <time class="summary">作者:前端之家 时间:2021-02-18</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/997483.html" title="ThinkPHP5中Session的使用"><div class="title">ThinkPHP5中Session的使用</div> <div class="summary">由于用惯了ThinkPHP之前的版本,一想到要用Session就直接用$_SESSION来存取,今天看了Thin...</div> <time class="summary">作者:前端之家 时间:2021-02-18</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/997482.html" title="空间session失效的解决方法"><div class="title">空间session失效的解决方法</div> <div class="summary">今天访问自己的网站的时候(by thinkphp),突然发现身份验证失效了,Session无法跨页,而...</div> <time class="summary">作者:前端之家 时间:2021-02-18</time> </a> </div> <div style="border-bottom: 1px solid #f4f4f4;margin-top:20px;"> <ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-fr-2o+fp-dx-wx" data-ad-client="ca-pub-4605373693034661" data-ad-slot="4561116489"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div><div class="list_con"> <a href="https://www.f2er.com/thinkphp/881456.html" title="tp6省略url里的index.php"><div class="title">tp6省略url里的index.php</div> <div class="summary">加个问号就行了</div> <time class="summary">作者:前端之家 时间:2020-11-07</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/881455.html" title="thinkphp无限分类模块实现"><div class="title">thinkphp无限分类模块实现</div> <div class="summary">数据表结构如下: 控制器核心代码: &lt;?php namespace appindexcontroller; use thi...</div> <time class="summary">作者:前端之家 时间:2020-11-07</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/881454.html" title="thinkphp5.1在php7.3下使用phpmailer报错"><div class="title">thinkphp5.1在php7.3下使用phpmailer报错</div> <div class="summary">thinkphp5.1在php7.3下使用phpmailer报错: unable to select [11]: Resource temporarily...</div> <time class="summary">作者:前端之家 时间:2020-11-07</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/881453.html" title="thinkphp--控制器怎么分配变量到公共模板"><div class="title">thinkphp--控制器怎么分配变量到公共模板</div> <div class="summary">应该是有很多种解决方法,我这边提供一个思路 定义一个公共控制器Base,其他控制器都继承自...</div> <time class="summary">作者:前端之家 时间:2020-11-07</time> </a> </div> <div class="list_con"> <a href="https://www.f2er.com/thinkphp/881452.html" title="tp5写入cookie失效"><div class="title">tp5写入cookie失效</div> <div class="summary">打算统计网站uv,使用cookie来实现 原先错误代码如下: // 获取UV function getUv(){ #当前...</div> <time class="summary">作者:前端之家 时间:2020-11-07</time> </a> </div> <div style="border-bottom: 1px solid #f4f4f4;margin-top:20px;"> <ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-fr-2o+fp-dx-wx" data-ad-client="ca-pub-4605373693034661" data-ad-slot="4561116489"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div></div> </div> </div> </div> <!-- left end--> <!-- right --> <div class="col-sm-12 col-md-12 col-lg-3"> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <label class="main-content-label ">编程分类</label> <div class="cate mt-20"><a href="https://www.f2er.com/php/" title="PHP">PHP</a><a href="https://www.f2er.com/java/" title="Java">Java</a><a href="https://www.f2er.com/javase/" title="Java SE">Java SE</a><a href="https://www.f2er.com/python/" title="Python">Python</a><a href="https://www.f2er.com/csharp/" title="C#">C#</a><a href="https://www.f2er.com/c/" title="C&C++">C&C++</a><a href="https://www.f2er.com/ruby/" title="Ruby">Ruby</a><a href="https://www.f2er.com/vb/" title="VB">VB</a><a href="https://www.f2er.com/aspnet/" title="asp.Net">asp.Net</a><a href="https://www.f2er.com/go/" title="Go">Go</a><a href="https://www.f2er.com/Perl/" title="Perl">Perl</a><a href="https://www.f2er.com/netty/" title="netty">netty</a><a href="https://www.f2er.com/django/" title="Django">Django</a><a href="https://www.f2er.com/delphi/" title="Delphi">Delphi</a><a href="https://www.f2er.com/jsp/" title="Jsp">Jsp</a><a href="https://www.f2er.com/netcore/" title=".NET Core">.NET Core</a><a href="https://www.f2er.com/spring/" title="Spring">Spring</a><a href="https://www.f2er.com/flask/" title="Flask">Flask</a><a href="https://www.f2er.com/springboot/" title="Springboot">Springboot</a><a href="https://www.f2er.com/springmvc/" title="SpringMVC">SpringMVC</a><a href="https://www.f2er.com/lua/" title="Lua">Lua</a><a href="https://www.f2er.com/laravel/" title="Laravel">Laravel</a><a href="https://www.f2er.com/mybatis/" title="Mybatis">Mybatis</a><a href="https://www.f2er.com/asp/" title="Asp">Asp</a><a href="https://www.f2er.com/groovy/" title="Groovy">Groovy</a><a href="https://www.f2er.com/thinkphp/" title="ThinkPHP">ThinkPHP</a><a href="https://www.f2er.com/yii/" title="Yii">Yii</a><a href="https://www.f2er.com/swoole/" title="swoole">swoole</a><div class="clearfix"></div> </div> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <!-- f2er-rightads --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4605373693034661" data-ad-slot="7756441254" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <label class="main-content-label ">最新文章</label> <ul class="n-list"><li><a href="https://www.f2er.com/thinkphp/997486.html" title="Thinkphp 缓存微信jssdk相关认证参数" target="_blank">• Thinkphp 缓存微信jssdk相</a></li> <li><a href="https://www.f2er.com/thinkphp/997485.html" title="用户登陆模块的后端实现" target="_blank">• 用户登陆模块的后端实现</a></li> <li><a href="https://www.f2er.com/thinkphp/997484.html" title="在ThinkPHP3.x框架中实现将原创文章第一时间推送到百度收录" target="_blank">• 在ThinkPHP3.x框架中实现将</a></li> <li><a href="https://www.f2er.com/thinkphp/997483.html" title="ThinkPHP5中Session的使用" target="_blank">• ThinkPHP5中Session的使用</a></li> <li><a href="https://www.f2er.com/thinkphp/997482.html" title="空间session失效的解决方法" target="_blank">• 空间session失效的解决方法</a></li> <li><a href="https://www.f2er.com/thinkphp/881457.html" title="thinkphp中include传参有缓存,模板缓存清理" target="_blank">• thinkphp中include传参有缓</a></li> <li><a href="https://www.f2er.com/thinkphp/881456.html" title="tp6省略url里的index.php" target="_blank">• tp6省略url里的index.php</a></li> <li><a href="https://www.f2er.com/thinkphp/881455.html" title="thinkphp无限分类模块实现" target="_blank">• thinkphp无限分类模块实现</a></li> <li><a href="https://www.f2er.com/thinkphp/881454.html" title="thinkphp5.1在php7.3下使用phpmailer报错" target="_blank">• thinkphp5.1在php7.3下使用</a></li> <li><a href="https://www.f2er.com/thinkphp/881453.html" title="thinkphp--控制器怎么分配变量到公共模板" target="_blank">• thinkphp--控制器怎么分配</a></li> </ul> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <label class="main-content-label ">热门标签 <span class="pull-right tx-12"> <a href="https://www.f2er.com/all" target="_blank">更多 ►</a></span> </label> <div class="topcard-tags"><a href="https://www.f2er.com/tag/wenjianshijian/" title="文件时间" target="_blank">文件时间</a><a href="https://www.f2er.com/tag/pythonm/" title="pythonm" target="_blank">pythonm</a><a href="https://www.f2er.com/tag/xiangdengxing/" title="相等性" target="_blank">相等性</a><a href="https://www.f2er.com/tag/PHPWarning/" title="PHP Warning" target="_blank">PHP Warning</a><a href="https://www.f2er.com/tag/shijianwenti/" title="时间问题" target="_blank">时间问题</a><a href="https://www.f2er.com/tag/wentijiejue/" title="问题解决" target="_blank">问题解决</a><a href="https://www.f2er.com/tag/pcntlsignal/" title="pcntl_signal()" target="_blank">pcntl_signal</a><a href="https://www.f2er.com/tag/caiyangdian/" title="采样点" target="_blank">采样点</a><a href="https://www.f2er.com/tag/wavmokuai/" title="wav模块" target="_blank">wav模块</a><a href="https://www.f2er.com/tag/dongtaiwenben/" title="动态文本" target="_blank">动态文本</a><a href="https://www.f2er.com/tag/diaoyongpinlvxianzhi/" title="调用频率限制" target="_blank">调用频率限制</a><a href="https://www.f2er.com/tag/duiwaibaolu/" title="对外暴露" target="_blank">对外暴露</a><a href="https://www.f2er.com/tag/duogefangwenqingqiu/" title="多个访问请求" target="_blank">多个访问请求</a><a href="https://www.f2er.com/tag/gengxinshujubiao/" title="更新数据表" target="_blank">更新数据表</a><a href="https://www.f2er.com/tag/moxingjiegou/" title="模型结构" target="_blank">模型结构</a><a href="https://www.f2er.com/tag/typefangfa/" title="type()方法" target="_blank">type()方法</a><a href="https://www.f2er.com/tag/bijiaosudu/" title="比较速度" target="_blank">比较速度</a><a href="https://www.f2er.com/tag/shouxieti/" title="手写体" target="_blank">手写体</a><a href="https://www.f2er.com/tag/sobelsuanzi/" title="sobel算子" target="_blank">sobel算子</a><a href="https://www.f2er.com/tag/baocunmoxing/" title="保存模型" target="_blank">保存模型</a><a href="https://www.f2er.com/tag/Imagelei/" title="Image类" target="_blank">Image类</a><a href="https://www.f2er.com/tag/nnConv2d/" title="nn.Conv2d" target="_blank">nn.Conv2d</a><a href="https://www.f2er.com/tag/pytorch10/" title="pytorch1.0" target="_blank">pytorch1.0</a><a href="https://www.f2er.com/tag/kaggle/" title="kaggle" target="_blank">kaggle</a><a href="https://www.f2er.com/tag/DCGAN/" title="DCGAN" target="_blank">DCGAN</a><a href="https://www.f2er.com/tag/jiaobingbi/" title="交并比" target="_blank">交并比</a><a href="https://www.f2er.com/tag/rangeyongfa/" title="range()用法" target="_blank">range()用法</a><a href="https://www.f2er.com/tag/dayinmoxing/" title="打印模型" target="_blank">打印模型</a><a href="https://www.f2er.com/tag/fanjuanji/" title="反卷积" target="_blank">反卷积</a><a href="https://www.f2er.com/tag/juanji/" title="卷积" target="_blank">卷积</a></div> </div> </div> </div> <!-- row end --> <!-- row --> <div class="row row-sm"> <div class="col-sm-12 col-md-12 col-lg-12"> <div class="card"> <!-- f2er-rightads --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4605373693034661" data-ad-slot="7756441254" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> <!-- row end --> </div> <!-- right end --> </div> </div> <footer id="footer"> <div class="container"> <div class="row hidden-xs"> <dl class="col-sm-6 site-link"> <dt>最近更新</dt><dd><a href="https://www.f2er.com/faq/884225.html" title="jQuery选择伪元素:after" target="_blank">· jQuery选择伪元素:after</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884224.html" title="JavaScript随机颜色生成器" target="_blank">· JavaScript随机颜色生成器</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884223.html" title="JavaScript指数" target="_blank">· JavaScript指数</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884222.html" title="addResourceHandlers无法解析静态资源" target="_blank">· addResourceHandlers无法解析静态资源</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884221.html" title="如何将字节数组转换为MultipartFile" target="_blank">· 如何将字节数组转换为MultipartFile</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884220.html" title="在java中如何创建一个文件并写入内容?" target="_blank">· 在java中如何创建一个文件并写入内容?</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884219.html" title="星号*在Python中是什么意思?" target="_blank">· 星号*在Python中是什么意思?</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884218.html" title="Flask框架:MVC模式" target="_blank">· Flask框架:MVC模式</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884217.html" title="在JavaScript对象数组中按ID查找对象" target="_blank">· 在JavaScript对象数组中按ID查找对象</a><span class="text-muted pull-right">10-20</span></dd> <dd><a href="https://www.f2er.com/faq/884216.html" title="使用Javascript / jQuery下载文件" target="_blank">· 使用Javascript / jQuery下载文件</a><span class="text-muted pull-right">10-20</span></dd> </dl> <dl class="col-sm-4 site-link"> <dt>好站推荐</dt><dd> <a href="https://www.runoob.com" title="菜鸟教程(www.runoob.com)提供了编程的基础技术教程, 介绍了HTML、CSS、Javascript、Python,Java,Ruby,C,PHP , MySQL等各种编程语言的基础知识。 同时本站中也提供了大量的在线实例,通过实例,您可以更好的学习编程。" target="_blank">菜鸟教程</a></dd><dd> <a href="https://www.jb51.cc" title="编程之家(www.jb51.cc)是成立于2017年面向全球中文开发者的技术内容分享平台。提供编程导航、编程问答、编程博文、编程百科、编程教程、编程工具、编程实例等开发者最需要的编程技术内容与开发工具支持,与你一起学习编程,相信编程改变未来!" target="_blank">编程之家</a></dd><dd> <a href="https://www.f2er.com" title="前端之家 f2er.com 前端开发人员所需学习知识手册。" target="_blank">前端之家</a></dd></dl> <dl class="col-sm-2 site-link"> <dt>商务合作</dt> <dd><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=76874919&site=qq&menu=yes">联系我们</a></dd> </dl> </div> <div class="copyright"> Copyright © 2019 前端之家. 当前版本 V7.0.16<br> <span class="ml5">前端之家 版权所有 <a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">闽ICP备13020303号-10</a></span> </div> </div> </footer> <script type="text/javascript" src="https://www.f2er.com/js/base.js"></script> </body> </html>