成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

ThinkPHP判斷IP地區(qū)位置

1.在Action目錄下添加如下代碼

點(diǎn)擊(

  1. public function index(){
  2.         $where = 'TRUE';
  3.         $membersModel = new Model("Members");
  4.         $rows = $membersModel->where($where)->select();
  5.         
  6.         if($rows){
  7.             import('ORG.Net.IpLocation');// 導(dǎo)入IpLocation類(lèi)
  8.             $Ip = new IpLocation('UTFWry.dat'); // 實(shí)例化類(lèi) 參數(shù)表示IP地址庫(kù)文件。下載dat文件到net目錄下
  9.             foreach ($rows as $k=>$v){
  10.                 $area = $Ip->getlocation($v['regIP']);
  11.                 $rows[$k]['location'] = isset($area['country'])?$area['country']:'未知地址';// 獲取某個(gè)IP地址所在的位置
  12.             }
  13.         }
  14.         $this->assign('rows',$rows);
  15.         $this->display();
  16.     }
2.在html頁(yè)面上添加

點(diǎn)擊(

  1. <table class="table table-striped table-hover table-condensed">
  2.             <tr>
  3.                 <th>用戶名</th>
  4.                 <th>郵箱</th>
  5.                 <th>注冊(cè)時(shí)間</th>
  6.                 <th>注冊(cè)IP</th>
  7.                 <th>激活狀態(tài)</th>
  8.             </tr>
  9.             
  10.             <volist name="rows" id="v">
  11.                 <tr>
  12.                     <th>{$v.username}</th>
  13.                     <th>{$v.email}</th>
  14.                     <th>{:date('Y-m-d H:i:s',$v['regTime'])}</th>
  15.                     <th>{$v.location}{$v.regIP}</th>
  16.                     <th><eq name="v.status" value="0"><span style="color: red">未激活</span><else/><span style="color:blue">已激活</span></eq></th>

  17.                 </tr>
  18.             </volist>
  19.         </table>



當(dāng)前名稱:ThinkPHP判斷IP地區(qū)位置
當(dāng)前路徑:http://jinyejixie.com/article6/ppjoig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站改版、商城網(wǎng)站、Google、響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)