PHP

PHP

Elasticsearch常用方法

创建索引<?php/***https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index_management.html*https://open.163.com/newview/movie/free?pid=XGG8PCIUJ&mid=HGG8PFDRB*/useElasticsearch\ClientBuilder;require&#39;./vendor/autoload.php&#3
PHP

利用redis的bitmap实现签到

<?php#https://xie.infoq.cn/article/9b0827c018443828d2f0ebedf#https://www.bbsmax.com/A/lk5aQwbZ51/#https://www.php.cn/php-weizijiaocheng-387074.html#setbitu:sign:1000:202108171uid:monthday1/*127.0.0.1:6379>setbitu:sign:1000:202108171(integer)0127.0.0
PHP

laravel打印页面SQL

修改app/Providers/AppServiceProvider.phpuseIlluminate\Support\Facades\DB;publicfunctionboot(){DB::listen(function($sql){//$sqlisanobjectwiththeproperties://sql:Thequery//bindings:thesqlqueryvariables//time:Theexecutiontimeforthequery//connectionName:Thename
PHP

PHP生成随机汉字

functiongetChar($num)//$num为生成汉字的数量{$b='';for($i=0;$i<$num;$i++){//使用chr()函数拼接双字节汉字,前一个chr()为高位字节,后一个为低位字节$a=chr(mt_rand(0xB0,0xD0)).chr(mt_rand(0xA1,0xF0));//转码$b.=iconv('GB2312','UTF-8',$a);}return$b;}echogetChar(mt_rand(100,2
PHP

利用pcntl实现异步任务

/***启动守护进程*/publicfunctionrunAction(){log_message(&#39;ERROR&#39;,&#39;daemon/run&#39;.&#39;|action:restart&#39;,&#39;daemon-&#39;);while(true){$this->fork_process();}exit;}/***创建子进程*/privatefunctionfork_process(){$ppid=
PHP

CURL的使用<发送与接收数据>

$headers=array("TYPE:xxxxooooo","TOKEN:00000000");$data=array(&#39;data&#39;=>array(&#39;name&#39;=>&#39;test&#39;,&#39;AGE&#39;=>22),&#39;registration_ids&#39;=>array(&#39;APA91b
PHP

javascript+php分片上传

<!DOCTYPEhtml><html><head><metacharset="UTF-8"/><title>xhr2</title></head><body><divid="drop_area"style="border:3pxdashedsilver;width:200px;height:200px">将图片拖拽到此</div&g
PHP

微信公众号开发(五)之JSSDK的配置

微信JS-SDK是微信公众平台 面向网页开发者提供的基于微信内的网页开发工具包。通过使用微信JS-SDK,网页开发者可借助微信高效地使用拍照、选图、语音、位置等手机系统的能力,同时可以直接使用微信分享、扫一扫、卡券、支付等微信特有的能力,为微信用户提供更优质的网页体验。首先...
PHP

微信公众号开发(三)之公众号菜单设置

使用公众号之前,需先要有菜单,下面来讲讲利用接口生成菜单栏。首先获取全局access_token,这个access_token和网页授权时的access_token是两个不同的东西。/***获取全局TOKEN*@returnmixed*/publicfunctiongetAccessToken(){$access_token_cache=$this->getCache(&#39;access_token&...
PHP

微信公众号开发(四)之微信网页授权获取微信用户信息

如果用户在微信客户端中访问第三方网页,公众号可以通过微信网页授权机制,来获取用户基本信息,进而实现业务逻辑(oauth2机制)。注意,在开发的时候,我们先设置网页授权回调域名先到公众平台官网中的“开发 - 接口权限 - 网页服务 - 网页帐号 - 网页授权获取用户基本信息...
热门搜索词