TP5

Thinkphp5判断是否使用手机访问,TP5如何区分PC端还是手机端访问?

判断用户是否使用手机端访问,这个是我们做web研发时经常遇到的一个功能点。 一个很简单的功能点,解决方案也有很多种,比如使用原生PHP通过分析UA来判断。 但如果你的后端用的是ThinkPHP5框架的话,解决这个功能点就更简单了,因为TP5的源码中已经封装好了,我们可以直接使用。 1 2 3 4 5 ......
手机 Thinkphp5 Thinkphp 还是 TP5

tp5.1 多条件搜索时搜索null和不为null

搜索null时 $map = []; $map[] = ['a.admin_id|a.department','null','']; 搜索不为null 时 $map = []; $map[] = ['a.admin_id|a.department','not null','']; ......
null 条件 tp5 tp

TP5查询数据列表追加字段

$userList = Db::name('user')->where('status',1)->select();$userList = array_map(function($item){ $item['newField'] = 'newValue'; // 在结果数组中追加新字段和值 retu ......
字段 数据 TP5 TP

tp5 update方法更新数据

thinkphp5的update方法: 返回影响数据的条数,没修改任何数据返回0 当要更新的数据和已存在数据库的数据一样时,返回的结果为0 修改失败返回false 所以在判断更新是否成功,要用 的条件进行判断 0 和 false的情况 public function update(){ $resul ......
方法 数据 update tp5 tp

tp5支付宝支付(当面付)

这里只说扫码支付,使用官方的代码,为什么没使用yansongda之类的组件,因为这个封装的太深了问题不好找,所以使用了官方的代码 支付宝支付文档:https://opendocs.alipay.com/open/270/01didh?pathHash=a6ccbe9a 官方代码仓库:https:// ......
当面 tp5 tp

TP5环境静态文件报404的解决方案

主要还是站点配置文件,找到vhost下的站点配置文件,代码如下 server { listen 80; server_name www.test.com test.com; index index.html index.htm index.php; #include /usr/local/nginx ......
静态 解决方案 环境 文件 方案

tp5.1 whereOr查询

public function workList(Request $request,$limit = 10){ if ($request->isAjax()) { $status = $request->param('state'); $map[] = ['state','neq',-1]; if( ......
whereOr tp5 tp

PHP批量压缩图片,基于TP5,fastadmin

``` * O(∩_∩)O * Date: 2022-7-7 09:34:38 */ namespace app\command; use think\Image; use think\image\Exception; use think\console\{Command, Input, Outpu ......
fastadmin 图片 PHP TP5 TP

TP5 验证金额是两位小数 ,1.2, 1, 0.01, 0.1都可以

'amount|价格' => ['require', 'max:128', 'float','>:0', 'regex' => '^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$'], ......
小数 金额 0.01 TP5 1.2

TP5-操作数据库

Db::query('select * from tp5_user where id = ? || name = ?',[$id,'Tom']); Db::execute('insert into tp5_user(name,age) values(?,?)',[$name,$age]); Db:: ......
数据库 数据 TP5 TP
共10篇  :1/1页 首页上一页1下一页尾页