安装有些PHP扩展后,直接把它添加到 php.ini 可能会报错。
这时候新建一个 ini 文件在 /etc/php.d/ 下面,重启 php-fpm 就好了。
document.onkeydown = function(e) { | |
var theEvent = e || window.event; | |
var code = theEvent.keyCode || theEvent.which || theEvent.charCode; | |
if (code == 13){ | |
// do something | |
} | |
} |
<?php | |
/** | |
* 模糊化微信聊天记录截图 | |
* | |
* 给聊天记录上方联系人昵称、右边头像、右边头像模糊化(for Jonns) | |
* | |
* @create 2015年4月8日00:00:00 | |
* | |
* @author AnyeGates <me@gatesanye.com> | |
*/ |
function get_func_define($function_name) | |
{ | |
$reflFunc = new ReflectionFunction($function_name); | |
return array( | |
'filename'=>$reflFunc->getFileName(), | |
'line'=> $reflFunc->getStartLine(), | |
'obj'=>$reflFunc | |
); | |
} |
#! /bin/sh | |
# | |
# chkconfig: - 84 16 | |
# description: PHP FastCGI Process Manager | |
# processname: php-fpm | |
# config: /etc/php-fpm.conf | |
# config: /etc/sysconfig/php-fpm | |
# pidfile: /var/run/php-fpm/php-fpm.pid | |
# | |
### BEGIN INIT INFO |
安装有些PHP扩展后,直接把它添加到 php.ini 可能会报错。
这时候新建一个 ini 文件在 /etc/php.d/ 下面,重启 php-fpm 就好了。
<?php | |
xhprof_enable(XHPROF_FLAGS_CPU+XHPROF_FLAGS_MEMORY); | |
register_shutdown_function(function() { | |
$xhprof_data = xhprof_disable(); | |
include_once __DIR__ . '/xhprof/xhprof_lib/utils/xhprof_lib.php'; | |
include_once __DIR__ . '/xhprof/xhprof_lib/utils/xhprof_runs.php'; | |
$xhprof_runs = new XHProfRuns_Default(); | |
$run_id = $xhprof_runs->save_run($xhprof_data, "ce"); | |
}); |
<?php | |
/** | |
* Flexihash - A simple consistent hashing implementation for PHP. | |
* | |
* The MIT License | |
* | |
* Copyright (c) 2008 Paul Annesley | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal |
function JSON($data) | |
{ | |
arrayRecursive($data, 'urlencode', true); | |
$json = json_encode($data); | |
return urldecode($json); | |
} |
function __json_encode( $obj ) | |
{ | |
if( defined( 'JSON_UNESCAPED_UNICODE' ) ){ // >= php 5.4 | |
return json_encode( $obj, JSON_UNESCAPED_UNICODE ); | |
} else { | |
return preg_replace( "/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", json_encode( $obj ) ); | |
} | |
} |