#343
#344
->whereIn('os.id',$oi_id) ->orderByRaw("FIELD(pre_os.id, " . implode(", ", $oi_id) . ")")
#345
#346
File>>Preferences>>settings>>UserSettings>>CommonlyUsed>>找到Editor:WordWrap,将off修改为on即可
#347
crontab -e
*/10 * * * * /usr/bin/curl https://xx.com/v2/other/strun
#348
JSON.stringify(a)!="{}" && JSON.stringify(a)!="[]" && a && a!='null'
#349
#350
$url='http://www.baidu.com'; $img = \QrCode::format('png')->size(200)->generate($url); //format 是指定生成文件格式 默认格式是svg,可以直接在浏览器打开,png不能直接显示 return $data = 'data:image/png;base64,' . base64_encode($img ); //转成base64,放在img的src里就可以显示
#351
<?php $url = 'http://localhost/3.php'; $opt_data = 'name=BY2&age=999&sex=MAXMAN'; $curl = curl_init(); //初始化 curl_setopt($curl,CURLOPT_URL,$url); //设置url curl_setopt($curl,CURLOPT_HTTPAUTH,CURLAUTH_BASIC); //设置http验证方法 curl_setopt($curl,CURLOPT_HEADER,0); //设置头信息 curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); //设置curl_exec获取的信息的返回方式 curl_setopt($curl,CURLOPT_POST,1); //设置发送方式为post请求 curl_setopt($curl,CURLOPT_POSTFIELDS,$opt_data); //设置post的数据 $result = curl_exec($curl); if($result === false){ echo curl_errno($curl); exit(); } print_r($result); curl_close($curl); ?>
PHP删除n天以前的文件,删除指定目录下指定类型(扩展名)的文件,包括子目录子和目录下的文件. 其中$ext数组代表不删除的文件扩展名. 调用函数trash('目录名',时间值);如trash('./files',3600) 参数时间值的单位是秒,如果省略不写,使用trash('./'),将删除当前时间10秒前及更早的文件. <?php function trash($folder,$time=10){ $ext=array('php','htm','html'); //带有这些扩展名的文件不会被删除. $o=opendir($folder); while($file=readdir($o)){ if($file !='.' && $file !='..' && !in_array(substr($file,strrpos($file,'.')+1),$ext)){ $fullPath=$folder.'/'.$file; if(is_dir($fullPath)){ trash($fullPath); @rmdir($fullPath); } else { if(time()-filemtime($fullPath) > $time){ unlink($fullPath); } } } } closedir($o); } trash('./');//调用自定义函数 ?>
#352
//echo 'dfasfads'; //dump(count($mendian_info)); if(!count($mendian_info)){ $mendian_info=[]; $mendian_info['0']['mendian_info_num']=0; $mendian_info['0']['sttt']=$sttt; //$mendian_info->{0}=''; //$mendian_info->{0}->mendian_info_num=0;//$mendian_info_num; //$mendian_info->{0}->sttt=$sttt; }//Base::exitError('fail'); else{ //$mendian_info['0']->mendian_info_num=count($mendian_info);//$mendian_info_num; //$mendian_info['0']->sttt=$sttt; } //dump($mendian_info); Base::exitSuccess('success',$mendian_info);
在别的地方看到了答案,贴到这里让更多同学们学习一下吧 $a = new \stdClass(); $a->{0} = "test"; var_dump($a); //object(stdClass)#1 (1) { ["0"]=> string(4) "test" } echo $a->{0}; //test
obj[0]['字段名字']
$where[] = ['in'=>['tn_user_base.id'=>$medical_number_ids]];
//in查询应该用whereIn $condition[] =['check_doctor_uid','in',$check_doctor_id]; // 错误 // Illuminate\Database\Query\Builder关于operators定义中,并没有in public $operators = [ '=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'like binary', 'not like', 'between', 'ilike', '&', '|', '^', '<<', '>>', 'rlike', 'regexp', 'not regexp', '~', '~*', '!~', '!~*', 'similar to', 'not similar to', 'not ilike', '~~*', '!~~*', ]; //->where($condition) 这种写法有问题
#353
killall -9 php php artisan workman start --d
killall -9 php ps aux|grep WorkerMan|awk '{print $2}'|xargs kill -9
php artisan workman start
#354
#服务器socket连接端口9999,为了避免冲突,这里用9990反向代理到9999,同时实现了wss转ws,服务器端不需要做修改 server { listen 9990; server_name xx.xx.xx.xx; ssl on; ssl_certificate "/usr/cert/barrage.crt"; ssl_certificate_key "/usr/cert/barrage.key"; ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_prefer_server_ciphers on; location /{ #反向代理到9999端口,同时协议转换为http,这样服务器端代码就不需要做修改 proxy_pass http://120.77.222.242:9999; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; #由于服务器端源码(建议大家做好大小写匹配)只匹配了"Upgrade"字符串,所以如果这里填"upgrade"服务器端会将这条http请求当成普通的请求,导致websocket握手失败 proxy_set_header Connection "Upgrade"; proxy_set_header Remote_addr $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 600s; } }
#355
#356
#357
#358
code
#359
<button open-type="contact" bindcontact="handleContact"></button> Page({ handleContact (e) { console.log(e.path) console.log(e.query) } })
#360
Remove the data-ride="carousel" attribute to fix JS error
改动一下 // ListTouch计算方向 ListTouchMove(e) { this.setData({ ListTouchDirection: e.touches[0].pageX - this.data.ListTouchStart > 0 ? 'right' : 'left' }) }, 这段,改成例如 // ListTouch计算方向 ListTouchMove(e) { var offset = e.touches[0].pageX - this.data.ListTouchStart if (offset > 50) { this.setData({ ListTouchDirection: 'right' }) } else if (offset < -50) { this.setData({ ListTouchDirection: 'left' }) } } 提高触发的偏移值就可以了。
DB::connection()->enableQueryLog(); // 开启查询日志 DB::table('my_table')->insert($data); // 要查看的sql语句执行 $logs = DB::getQueryLog(); // 获取查询日志 dd($logs); // 即可查看执行的sql,传入的参数等等
->where(function ($query) use ($keyword) { $query->where('name', 'like', "%{$keyword}%")->orWhere('barcode', 'like', "%{$keyword}%"); })
#361
$roomUuid = 1; $chatInfo = DB::table('chat_info') ->where('chat_info.room_uuid', $roomUuid) ->leftJoin('user_rooms', function ($join) { $join->on('user_rooms.user_uuid', '=', 'chat_info.user_uuid') ->on('user_rooms.room_uuid', '=', 'chat_info.room_uuid'); })
确定要清除编辑框内容吗?
该删除操作将不可恢复。
删除 取消
激活Windows
转到"设置"以激活Windows。
#343
#344
->whereIn('os.id',$oi_id) ->orderByRaw("FIELD(pre_os.id, " . implode(", ", $oi_id) . ")")#345
#346
File>>Preferences>>settings>>UserSettings>>CommonlyUsed>>找到Editor:WordWrap,将off修改为on即可#347
crontab -e*/10 * * * * /usr/bin/curl https://xx.com/v2/other/strun#348
JSON.stringify(a)!="{}" && JSON.stringify(a)!="[]" && a && a!='null'#349
#350
$url='http://www.baidu.com'; $img = \QrCode::format('png')->size(200)->generate($url); //format 是指定生成文件格式 默认格式是svg,可以直接在浏览器打开,png不能直接显示 return $data = 'data:image/png;base64,' . base64_encode($img ); //转成base64,放在img的src里就可以显示#351
<?php $url = 'http://localhost/3.php'; $opt_data = 'name=BY2&age=999&sex=MAXMAN'; $curl = curl_init(); //初始化 curl_setopt($curl,CURLOPT_URL,$url); //设置url curl_setopt($curl,CURLOPT_HTTPAUTH,CURLAUTH_BASIC); //设置http验证方法 curl_setopt($curl,CURLOPT_HEADER,0); //设置头信息 curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); //设置curl_exec获取的信息的返回方式 curl_setopt($curl,CURLOPT_POST,1); //设置发送方式为post请求 curl_setopt($curl,CURLOPT_POSTFIELDS,$opt_data); //设置post的数据 $result = curl_exec($curl); if($result === false){ echo curl_errno($curl); exit(); } print_r($result); curl_close($curl); ?>PHP删除n天以前的文件,删除指定目录下指定类型(扩展名)的文件,包括子目录子和目录下的文件. 其中$ext数组代表不删除的文件扩展名. 调用函数trash('目录名',时间值);如trash('./files',3600) 参数时间值的单位是秒,如果省略不写,使用trash('./'),将删除当前时间10秒前及更早的文件. <?php function trash($folder,$time=10){ $ext=array('php','htm','html'); //带有这些扩展名的文件不会被删除. $o=opendir($folder); while($file=readdir($o)){ if($file !='.' && $file !='..' && !in_array(substr($file,strrpos($file,'.')+1),$ext)){ $fullPath=$folder.'/'.$file; if(is_dir($fullPath)){ trash($fullPath); @rmdir($fullPath); } else { if(time()-filemtime($fullPath) > $time){ unlink($fullPath); } } } } closedir($o); } trash('./');//调用自定义函数 ?>#352
//echo 'dfasfads'; //dump(count($mendian_info)); if(!count($mendian_info)){ $mendian_info=[]; $mendian_info['0']['mendian_info_num']=0; $mendian_info['0']['sttt']=$sttt; //$mendian_info->{0}=''; //$mendian_info->{0}->mendian_info_num=0;//$mendian_info_num; //$mendian_info->{0}->sttt=$sttt; }//Base::exitError('fail'); else{ //$mendian_info['0']->mendian_info_num=count($mendian_info);//$mendian_info_num; //$mendian_info['0']->sttt=$sttt; } //dump($mendian_info); Base::exitSuccess('success',$mendian_info);在别的地方看到了答案,贴到这里让更多同学们学习一下吧 $a = new \stdClass(); $a->{0} = "test"; var_dump($a); //object(stdClass)#1 (1) { ["0"]=> string(4) "test" } echo $a->{0}; //testobj[0]['字段名字']$where[] = ['in'=>['tn_user_base.id'=>$medical_number_ids]];$where[] = ['in'=>['tn_user_base.id'=>$medical_number_ids]];//in查询应该用whereIn $condition[] =['check_doctor_uid','in',$check_doctor_id]; // 错误 // Illuminate\Database\Query\Builder关于operators定义中,并没有in public $operators = [ '=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'like binary', 'not like', 'between', 'ilike', '&', '|', '^', '<<', '>>', 'rlike', 'regexp', 'not regexp', '~', '~*', '!~', '!~*', 'similar to', 'not similar to', 'not ilike', '~~*', '!~~*', ]; //->where($condition) 这种写法有问题#353
killall -9 php php artisan workman start --dkillall -9 php ps aux|grep WorkerMan|awk '{print $2}'|xargs kill -9php artisan workman start#354
#服务器socket连接端口9999,为了避免冲突,这里用9990反向代理到9999,同时实现了wss转ws,服务器端不需要做修改 server { listen 9990; server_name xx.xx.xx.xx; ssl on; ssl_certificate "/usr/cert/barrage.crt"; ssl_certificate_key "/usr/cert/barrage.key"; ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_prefer_server_ciphers on; location /{ #反向代理到9999端口,同时协议转换为http,这样服务器端代码就不需要做修改 proxy_pass http://120.77.222.242:9999; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; #由于服务器端源码(建议大家做好大小写匹配)只匹配了"Upgrade"字符串,所以如果这里填"upgrade"服务器端会将这条http请求当成普通的请求,导致websocket握手失败 proxy_set_header Connection "Upgrade"; proxy_set_header Remote_addr $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 600s; } }#355
#356
#357
#358
code#359
<button open-type="contact" bindcontact="handleContact"></button> Page({ handleContact (e) { console.log(e.path) console.log(e.query) } })在页面使用客服消息
需要将 button 组件 open-type 的值设置为 contact,当用户点击后就会进入客服会话,如果用户在会话中点击了小程序消息,则会返回到小程序,开发者可以通过 bindcontact 事件回调获取到用户所点消息的页面路径 path 和对应的参数 query。
path 小程序消息指定的路径
query 小程序消息指定的查询参数
修改 return $_GET["echostr"]
return回来的echostr是带双引号,而echo回来的echostr是不带双引号的。
#360
Remove the data-ride="carousel" attribute to fix JS errorBootstrap Carousel: Uncaught TypeError: Cannot read property 'offsetWidth' of undefined
改动一下 // ListTouch计算方向 ListTouchMove(e) { this.setData({ ListTouchDirection: e.touches[0].pageX - this.data.ListTouchStart > 0 ? 'right' : 'left' }) }, 这段,改成例如 // ListTouch计算方向 ListTouchMove(e) { var offset = e.touches[0].pageX - this.data.ListTouchStart if (offset > 50) { this.setData({ ListTouchDirection: 'right' }) } else if (offset < -50) { this.setData({ ListTouchDirection: 'left' }) } } 提高触发的偏移值就可以了。DB::connection()->enableQueryLog(); // 开启查询日志 DB::table('my_table')->insert($data); // 要查看的sql语句执行 $logs = DB::getQueryLog(); // 获取查询日志 dd($logs); // 即可查看执行的sql,传入的参数等等Laravel 系列:orWhere 条件式
->where(function ($query) use ($keyword) { $query->where('name', 'like', "%{$keyword}%")->orWhere('barcode', 'like', "%{$keyword}%"); })foreach()循环
要跳出本次循环继续执行下次循环 continue
终止循环
break。
#361
$roomUuid = 1; $chatInfo = DB::table('chat_info') ->where('chat_info.room_uuid', $roomUuid) ->leftJoin('user_rooms', function ($join) { $join->on('user_rooms.user_uuid', '=', 'chat_info.user_uuid') ->on('user_rooms.room_uuid', '=', 'chat_info.room_uuid'); })