
php
luobaobin
这个作者很懒,什么都没留下…
展开
-
windows2个本地项目curl访问
1.nginx/conf/vhosts.conf添加fastcgi_pass端口server { listen 80; server_name www.myreport.com ; root "D:\phpStudy\PHPTutorial\WWW\php/report\code\public"; location / { index index.html index.htm index.php;...原创 2020-09-25 17:15:46 · 1222 阅读 · 0 评论 -
excel多sheet导出
$post = I('get.');//用户画像,9个分类同时导出,9个sheet$dataAll = [];$tagname = D('SpsTag')->where(['tag_category' => 3, 'tag_dict_id' => ['between', [1, 9]]])->getField('tag_dict_id,tag_dict_value');foreach ($tagname as $k=>$v){ $post['tag_3'] .原创 2020-09-10 13:55:39 · 344 阅读 · 0 评论 -
es封装类以及示例(基于tp3.2)
1.类代码<?phpnamespace Achievement\Service;class EsCommonService{ private $index = 'order_index';//可以理解为mysql的表 private $must = []; private $mustNot = []; private $mustNested = [];//must子文档嵌套 private $mustNotNested = [];//must_no.原创 2020-09-02 10:59:46 · 370 阅读 · 0 评论 -
bat服务注册启动删除
@echo offset apache_vc=electronic_apacheset database_vc=electronic_mysqlset workerman_vc=electronic_workerset apache_port=80set database_port=1177::C:\electronic\set project_root=%~dp0%set ...原创 2019-06-17 09:16:46 · 720 阅读 · 0 评论 -
CutyCapt.exe网页截屏保存成图片
$pos = explode(':', $_SERVER['DOCUMENT_ROOT']);$disk = $pos[0];$this->commond = $disk.': && cd '.$_SERVER['DOCUMENT_ROOT'].' && CutyCapt.exe '." --url={$url} --out={$filepath} --...原创 2019-06-10 17:25:42 · 301 阅读 · 0 评论 -
版本迭代数据库结构更新sql
/* 文件说明 * 用于数据库表结构版本更新,注意以下几点: * 1.新增表不能删除旧的表,否则数据丢失,CREATE TABLE IF NOT EXISTS * 2.新增字段、修改字段、删除字段,新增索引,删除索引,调用存储过程实现,否则第二次运行报错,存储过程名字Pro_Temp_ColumnWork, Pro_Temp_Index * 3.sql语句放在删除存储过...原创 2019-05-08 18:11:42 · 1694 阅读 · 0 评论 -
laravel依赖注入
依赖注入其实就是interface在laravel的实现,他不会直接new对象,而是通过传参获取对象的实例。比如经典的例子,超人有超能力,但是超能力有很多,比如火焰、冰霜,直接在超人class里面new火焰超能力,如果要换超能力的话,还得修改超人class的代码,通过interface制定契约就可以避免这种依赖。举一个支付的例子。1.支付接口<?phpnamespace Ap...原创 2019-02-23 20:29:45 · 1705 阅读 · 0 评论 -
获取window或linux下php路径
if(substr(strtolower(PHP_OS), 0, 3) == 'win'){ $ini= ini_get_all(); $path = $ini['extension_dir']['local_value']; $b= substr($path,0,-3); $php_path = str_replace('\\','/',$b); $rea...原创 2018-04-18 10:32:32 · 1249 阅读 · 0 评论 -
mysql事务嵌套
假如需要调用方法a,方法a里面有方法b,他们都含有mysql事务,会报错,所以要用程序记录嵌套层数,里面方法报错,外面也不能提交private $transaction_count = 0;//事务嵌套层级public function beginTransaction(){ ++ $this->transaction_count; if($this->transac...转载 2018-03-07 15:30:12 · 805 阅读 · 0 评论 -
linux指令
1.匹配内容批量杀死进程(匹配test.php)ps -ef|grep test.php|grep -v grep|cut -c 9-15|xargs kill -9转载 2017-07-25 10:25:09 · 201 阅读 · 0 评论