-
PHP判断当前协议是否为HTTPS
/***PHP判断当前协议是否为HTTPS*/functionis_https(){if(!empty($_SERVER['HTTPS'])&&strtolower($_SERVER['HTTPS'])!=='off'){returntrue;}elseif(isset($_SERVER['HTTP_X_FORWARDED_PROTO'])&&$_SERVER['HTTP_X_FORWARDED_… -
tp5.1 Workerman 配置websocket支持wss
protected$socket='websocket://0.0.0.0:2346';//监听协议、地址、和端口protected$context=['ssl'=>['local_cert'=>'D:\ssl\leakeyun.com.crt',//绝对路径'local_pk'=>'D:\ssl\leakeyun.com.key',//绝对路径'verify_peer'=>false,],];p… -
PHP jieba分词
jieba(结巴)中文分词拓展包安装composerrequirefukuball/jieba-php:dev-master分词使用useFukuball\Jieba\Jieba;useFukuball\Jieba\Finalseg;ini_set('memory_limit','2048M');Jieba::init();Finalseg::init();$strArr=Jieba::cut("… -
sqlServer创建数据库并指定mdf,ldf文件所在路径
CREATEDATABASE[dataBaseName]CONTAINMENT=NONEONPRIMARY(NAME=N'student_manage',FILENAME=N'D:\dataBaseName.mdf',SIZE=8192KB,MAXSIZE=UNLIMITED,FILEGROWTH=65536KB)LOGON(NAME=N'student_manage_log',FILENAME=… -
tp5 数据表字段为逗号分隔的字符串,查询该字段中是否包含某个值
例:数据表cid字段为1,2,34,5,6,7,8,9,10,11需求:需要查询cid为1的数据解决:使用find_in_set(查找值,字段名)Db::table('think_user')->where('find_in_set(1,sids)')->select(); -
CentOS 7.6下宝塔面板 PHP7.2安装sqlsrv扩展
PHP需要的相关环境(慎用yumupdate)yumupdateyuminstallphpphp-pdophp-xmlphp-pearphp-develre2cgcc-c++gcc1、加微软源curlhttps://packages.microsoft.com/config/rhel/7/prod.repo>/etc/yum.repos.d/mssqlrelease.repo如果发现这个链接失效了… -
php 机型 浏览器 操作系统判断
机型if(!function_exists('get_client_device')){functionget_client_device(){if(request()->isMobile()){$agent=strtolower($_SERVER['HTTP_USER_AGENT']);if(preg_match('/iPhone\s([^\s|;]+)/i',$agent)){return'i… -
tp5.1 对sqlserver数据库进行备份、恢复备份操作
//执行备份$link=Db::connect(数据库配置array);$link->execute("backupdatabaseLKTESTtodisk='备份目录/备份文件'");//恢复备份$link->execute("RESTOREDATABASE数据库名FROMDISK='备份文件地址'WITHReplace");//使用while的话,是因为如果不用就不行。。。。while(tru…