Chinaunix首页 | 论坛 | 博客
  • 博客访问: 695086
  • 博文数量: 143
  • 博客积分: 1554
  • 博客等级: 上尉
  • 技术积分: 1767
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-10 11:50
文章分类

全部博文(143)

文章存档

2017年(2)

2016年(5)

2015年(16)

2014年(25)

2013年(27)

2012年(16)

2011年(52)

分类: PHP

2013-12-11 18:55:54

1.在Action目录下添加如下代码

点击(此处)折叠或打开

  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');// 导入IpLocation类
  8.             $Ip = new IpLocation('UTFWry.dat'); // 实例化类 参数表示IP地址库文件。下载dat文件到net目录下
  9.             foreach ($rows as $k=>$v){
  10.                 $area = $Ip->getlocation($v['regIP']);
  11.                 $rows[$k]['location'] = isset($area['country'])?$area['country']:'未知地址';// 获取某个IP地址所在的位置
  12.             }
  13.         }
  14.         $this->assign('rows',$rows);
  15.         $this->display();
  16.     }
2.在html页面上添加

点击(此处)折叠或打开

  1. <table class="table table-striped table-hover table-condensed">
  2.             <tr>
  3.                 <th>用户名</th>
  4.                 <th>邮箱</th>
  5.                 <th>注册时间</th>
  6.                 <th>注册IP</th>
  7.                 <th>激活状态</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>



阅读(618) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~