找回密码
 立即注册
搜索
查看: 381|回复: 1

[其它] 提取出ThinkPHP3.1.3完整的M方法,完全可以符合TP3.1.3的写法

  [复制链接]
发表于 2023-2-23 17:09 | 显示全部楼层 |阅读模式

提取出ThinkPHP3.1.3完整的M方法,完全符合ThinkPHP3.1.3的写法,可用于小项目也可以单独使用处理数据库方面,简单、粗暴、方便、便携,由于是pdo方式,更安全。

示例:
 

//统计2016年入学的学生

$count = M('user')->where(['banji'=>2016])->count();

 

//取出user表班级为2016年入学的学生

$rows = M('user')->where(['banji'=>2016])->select();

 

//添加一条学生信息

M('user')->data(['username'=>''])->add();

 

//将uid为10的学生名称置空

M('user')->data(['username'=>''])->where(['uid'=>10])->add();

 

//删除uid为10的学生信息

M('user')->where(['uid'=>10])->delete();

附下载链接:下载PDOMysql.class.zip

 楼主| 发表于 2023-2-23 18:01 | 显示全部楼层
一不小心,将文件PDOMysql.Lib.class.php压缩成为.php.zip后,发现一个奇怪的问题:如附件名为:PDOMysql.Lib.class.php.zip在我的php环境报500错误。

我的php环境为phpStudy2006的php环境,Apache/2.4.23 (Win32)  mod_fcgid/2.3.9。当解析.php.zip时报500错误。找到错误日志:
[Thu Feb 23 17:27:36.053000 2023] [fcgid:error] [pid 9788:tid 12620] (9)Bad file descriptor: [client 127.0.0.1:35687] mod_fcgid: don't know how to spawn child process: E:/0000000/upload/data/attachment/forum/202302/23/PDOMysql.Lib.class.php.zip
[Thu Feb 23 17:45:12.586000 2023] [win32:error] [pid 9788:tid 12620] [client 127.0.0.1:37962] AH02102: E:/0000000/upload/data/attachment/forum/202302/23/PDOMysql.Lib.class.php.zip is not executable; ensure interpreted scripts have "#!" or "'!" first line

只要带上.php.zip就报错,唉,不管它了,改个后缀名就行了。网上说是文件扩展解析问题:
总结:网上说的“低版本的apache存在未知扩展名解析漏洞”的说法是错误的,正确的说法应该是使用module模式与php结合的所有版本apache存在未知扩展名解析漏洞,使用fastcig模式与php结合的所有版本apache不存在此漏洞。
有兴趣的可以详细了解一下,参考网址:
https://www.zhiu.cn/177436.html
https://www.cnblogs.com/drkang/p/8466990.html
https://mg123.lofter.com/post/1a5f3e_a07d3fd
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|学习笔记

GMT+8, 2024-10-18 17:17 , Processed in 0.019964 second(s), 13 queries , APCu On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表