gorm去重查询 iris框架

摘要: 写练习 demo 时遇到需要进行去重查询,gorm没有db.distinct()的写法 // 数据库的表字段 type Pro_location_relation struct { Id int64 Provicename string Cityname string Areaname string 阅读全文
posted @ 2020-09-10 16:13 EchoBao 阅读(4356) 评论(0) 推荐(0) 编辑

php防sql注入

摘要: 原始没有防sql注入操作: public function sql_export(Request $request){ $username = $request -> get("username"); $password = $request -> get("password"); $data = 阅读全文
posted @ 2020-07-21 16:37 EchoBao 阅读(255) 评论(0) 推荐(0) 编辑

nginx配置根据url的参数值进行转发

摘要: server { listen 8081; location / { set $tag ""; set $cs "/index/test/test"; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Host $http_ 阅读全文
posted @ 2020-07-01 15:19 EchoBao 阅读(11065) 评论(0) 推荐(0) 编辑

使用phpexcel导出excel和phpword导出word--简单使用

摘要: <?php namespace app\index\controller; //离线环境不能使用composer安装,只能下载包文件,然后放在vendor下,代码中require使用 require_once VENDOR_PATH.'/PHPExcel/PHPExcel.php'; use app 阅读全文
posted @ 2020-06-10 14:51 EchoBao 阅读(716) 评论(0) 推荐(0) 编辑

tp5上传图片常规

摘要: 前端不多说,就是使用input标签的file格式。 tp5用request()->file(‘input的名字’)接收图片,是binary格式的数据; $file = request()->file('file'); $info = $file->move('存放的路径');这一步有坑,php.in 阅读全文
posted @ 2020-04-27 20:23 EchoBao 阅读(680) 评论(0) 推荐(0) 编辑

goland使用go mod模式

摘要: 使用go mod之后,想要在goland中有代码提示,有两种方式,一种是使用gopath下的goimport工具,另一种是使用gomod自身的管理工具 我是用的是非gopath的方式,每次新建项目后总是报错 go list -m: can't compute 'all' using the vend 阅读全文
posted @ 2020-04-25 17:23 EchoBao 阅读(12191) 评论(0) 推荐(1) 编辑

猴子当大王算法 约瑟夫环

摘要: 线性算法 阅读全文
posted @ 2019-10-23 16:07 EchoBao 阅读(164) 评论(0) 推荐(0) 编辑

mysql优化

摘要: 查询sql语句的运行时间 show profiles;使用这个语句,首先要开启profiling,默认不开启,set profiling = 1;开启;使用完之后关闭; show profile cpu for query 2;对第二个查询语句进行查看cpu时间,cpu可以换成其他参数 查询到sql 阅读全文
posted @ 2018-09-19 17:24 EchoBao 阅读(107) 评论(0) 推荐(0) 编辑

选择和快速排序

摘要: //选择排序 public function index(){ $arr = array(10,5,245,23,543,67,45,37,86,235,25,15); for($i = 0;$i < count($arr) - 1;$i++){ $minindex = $i; for($j = $ 阅读全文
posted @ 2018-09-11 11:07 EchoBao 阅读(98) 评论(0) 推荐(0) 编辑

php的冒泡算法

摘要: <?php$arr = array(5,21,5,7,8,3,435,745,234,23,45,67,8767,789,98,8,9);echo 'before: ';var_dump($arr);echo 'after: ';var_dump(maopao($arr));function mao 阅读全文
posted @ 2018-05-03 11:43 EchoBao 阅读(316) 评论(0) 推荐(0) 编辑