这段代码在 stackoverflow 上搜到, 据说是 Smarty 用的.
各位需要的可以试试
function smarty_modifier_emojistrip($string)
{
return preg_replace('/\xEE[\x80-\xBF][\x80-\xBF]|\xEF[\x81-\x83][\x80-\xBF]/', '', $string);
}
jincon 发表于 2016-06-27, 9:56 PM
这段代码在 stackoverflow 上搜到, 据说是 Smarty 用的.
各位需要的可以试试
function smarty_modifier_emojistrip($string)
{
return preg_replace('/\xEE[\x80-\xBF][\x80-\xBF]|\xEF[\x81-\x83][\x80-\xBF]/', '', $string);
}
jincon 发表于 2016-06-24, 3:17 PM
Discuz中 uc.php文件 uc-key执行漏洞修复方法
DZ uc.php文件 uc-key漏洞修复方法
主要修复方法参照:
dz3.2 最新版本:
文件:
api/uc.php
1、约241行:
function updatebadwords($get, $post) { global $_G; if(!API_UPDATEBADWORDS) { return API_RETURN_FORBIDDEN; } $data = array(); if(is_array($post)) { foreach($post as $k => $v) { //dz官网修复方法 uc-key方法。 6.24 if(substr($v['findpattern'], 0, 1) != '/' || substr($v['findpattern'], -3) != '/is') { $v['findpattern'] = '/' . preg_quote($v['findpattern'], '/') . '/is'; } //end $data['findpattern'][$k] = $v['findpattern']; $data['replace'][$k] = $v['replacement']; } }
» 阅读全文
jincon 发表于 2016-06-20, 10:40 AM
微信服务器白名单IP列表,列出以便自己做白名单使用。
[0] => 101.226.62.77
[1] => 101.226.62.78
[2] => 101.226.62.79
[3] => 101.226.62.80
[4] => 101.226.62.81
[5] => 101.226.62.82
[6] => 101.226.62.83
[7] => 101.226.62.84
[8] => 101.226.62.85
[9] => 101.226.62.86
» 阅读全文
jincon 发表于 2016-06-14, 10:39 PM
今天在开发公司的项目过程,在使用微信支付的时候,请求非常慢。
主要请求慢的原因是微信支付需要授权,获取openid,
$tools = new \JsApiPay(); $openId = $tools->GetOpenid();了解微信的人都知道,微信的授权获取微信openid 需要进行2各小步骤,第一步先获取code,
第二步拿到code,再去请求第二个接口,获取openid。
由于微信授权,普通的浏览器是看不到效果的,所以可以通过抓包的时候来搞,抓包软件,我mac用的是青花瓷
通过一步步分析发现。原来是在第二部的时候,请求非常慢:主要请求接口域名是:
https://api.weixin.qq.com
但是我其他服务器都是好好的,非常快啊,为何部署支付的服务器这么慢呢?
腾讯不应该出现这么慢的服务器啊。
于是分别在2个服务器上ping了下。最后对比下发现,虽然本地和服务器上ping返回的time差不多的,
但是,明显服务器上返回1个ping,本地都返回6~9个ping了,说明还是服务器问题。
如果同时ping ip的话,就差不多,进而想到,很可能是服务器设置的DNS的问题,
服务器DNS解析的微信接口的API地址非常慢。
ssh 登录下服务器:
看下,dns是使用安徽的一个老的dns,和谷歌的dns,果断换成腾讯的dns和阿里云的dns
搜嘎。感觉速度非常快了。
如果各位遇到这个问题,记得这么去排查下。
这个主要是由微信支付引起的一个微信授权api的问题。
jincon 发表于 2016-06-11, 1:42 PM
PHP CURL实现并发多线程,主要就是以:curl_multi_ * 的类库。一个简单的demo。
另外感觉curl多线程没有想想那么的好,各位适应php的扩展 pthread
$urls = array(
'http://localhost/test/time.php',
'http://localhost/test/time.php',
'http://localhost/test/time.php',
'http://localhost/test/time.php',
'http://localhost/test/time.php',
'http://localhost/test/time.php',
'http://localhost/test/time.php',
» 阅读全文
jincon 发表于 2016-06-09, 1:58 PM
那么php与nginx的常规协作方式是如何的呢?需要我们明确几个概念
通用网关接口,是HTTP协议中描述的,Web Server与后端处理程序进程间通信的协议
» 阅读全文