![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
thinkphp
疯癫居士
这个作者很懒,什么都没留下…
展开
-
TP5谷歌验证
把 GoogleAuthenticator.php 放到插件库GoogleAuthenticator.php<?php/** * PHP Class for handling Google Authenticator 2-factor authentication. * * @author Michael Kliewe * @copyright 2012 Michael Kliewe * @license http://www.opensource.org/l...原创 2020-08-20 15:35:13 · 978 阅读 · 0 评论 -
tp5接口写法实例
// 控制器``` /** * 添加收货地址 */ public function addAddress(){ $post = $this->request->post(); //验证 唯一规则: 表名,字段名,排除主键值,主键名 $validate = new \think\Validate([ ...原创 2018-09-13 10:33:55 · 14109 阅读 · 0 评论 -
tp5 随机获取商品
/** * 随机获取商品 */ public function getRandGoods(){ $map['status'] = 1; //状态;上架 $map['num'] = ['>','0'];//库存 $query = model('goods'); $about = $qu...原创 2018-09-05 10:57:26 · 1624 阅读 · 0 评论 -
ip判断国家
1. 下载数据库和 PHP 库文件下载 GeoID.dat.gz, 解压为 GeoIP.dat 文件. http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz下载 geoip.inc.http://www.maxmind.com/download/geoip/api/php/geoip.inc2...原创 2018-05-31 17:28:42 · 2284 阅读 · 3 评论 -
tp5 session_id 跨域
<?phpnamespace app\appApi\controller;header('Access-Control-Allow-Origin: *');header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");header('Access-Control-Allow-Me原创 2017-06-19 17:16:29 · 6483 阅读 · 0 评论 -
php微信 - 8thinkphp笔记
<?phpnamespace Admin\Controller;use Think\Controller;class IndexController extends Controller { // 接入数据 public function index(){ $nonce = $_GET['nonce']; $timestamp = $_GET['原创 2017-05-31 20:27:55 · 401 阅读 · 0 评论 -
php微信 - 7curl get 和post封装
封装curl public function http_curl($url, $type = 'get', $res = 'json', $arr = ''){ $cl = curl_init(); curl_setopt($cl, CURLOPT_URL, $url); curl_setopt($cl, CURLOPT_RETURNTRANSFER,原创 2017-05-31 20:24:46 · 1149 阅读 · 0 评论 -
thinkphp事务处理
thinkphp事务处理事务处理原创 2017-05-24 16:35:14 · 310 阅读 · 0 评论 -
thinkphp模糊查询
模糊查询原创 2017-05-24 16:43:21 · 341 阅读 · 0 评论 -
php 如何让curl不在页面上显示
如何让curl不在页面上显示有时后会遇到使用了curl后数据老是在页面输出,想存到变量也存不进去的情况。。。接口拿到数据是兴奋的,可。。。。我不想你显示啊!!! 后来我发现要加一句curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);。。。尴尬啊!害的我找了大半天输出语句,以为哪里输出了~(O_O)~原创 2017-03-03 20:40:11 · 791 阅读 · 0 评论 -
thinkphp syntax error ,unexpected ‘$this’(T_VARIABLE) 报错
Call to a member function display() on a non-object 报错不少老司机也可能犯的错误。。。不要打我。。。 那是因为。。。没有基础遗产 T T如何继承? public function __construct(){ parent::__construct(); }好啦没事了,居然会犯这样的低级错误。。。。原创 2017-03-03 20:20:25 · 8210 阅读 · 0 评论 -
真XX项目 TP连贯操作总结
真XX项目 TP连贯操作总结field方法的用法参考链接:CURD方法盘点:field方法用于查询在查询操作中field方法是使用最频繁的。eg1:$Model ->field('id,title,content') ->select();复制代码这里使用field方法指定了查询的结果集中包含id,title,content三个字段的值。执行的SQL相当于: SELECT id原创 2017-02-20 16:58:14 · 1336 阅读 · 0 评论