<?php namespace app\index\controller; use think\Db; use think\Controller; class Base extends Controller { public function _initialize(){ $no_check = array("login","login_check"); $request = \think\Request::instance(); echo $request-
在获取数据的字段值后自动进行处理 // 模型中写入如下代码,则查询结果会自动将status的结果进行转换 class User extends Model { public function getStatusAttr($value){ $status = [-1=>'删除',0=>'禁用',1=>'正常',2=>'待审核']; return $status[$value]; } } class User extends Controller { public function s
class IPAddress extends Common { /** * 根据ip地址,获取用户所在省市 */ public function ipIndex() { $ip = "222.22.22.11";// 默认设置一个ip地址(可自行获取) include "../vendor/topthink/Iplocation.php";//引入文件 $Ips =new \IpLocation\IpLocation('UTFWry.dat'); // 实例化类