public function outExcelRecharge() {
$list = M('Order')
->table('__ORDER__ as o')
->join('__USER__ as u on u.id=o.user_id')
->join('__STUDENT__ as s on s.student_id=o.student_id','left')
->field('o.order_id,u.nickname,o.total_price,o.add_time,o.order_no,o.status,o.goods_titl...
银联支付订单无效或已失效
首先,我已经确定你已经把那证书弄好了,也放入了你的系统里,要不然你在请求支付获取支付参数时就失败了。
出现这个错误是需要客户端把测试模式改成生产模式:
银联支付报错8100009
这样改了后,就可以成功支付了。
——————————————————————
银联app支付成功后,后台回调的处理
在...
/**
* 批量更新数据
* @param string $table_name
* @param array $data
* @param string $field
* @return bool|false|int
*/
function db_batch_update($table_name = '', $data = array(), $field = '',$sql='') {
if (!$table_name || !$data || !$field) {
...
function count_word($str){
$str = preg_replace('/[\x80-\xff]{1,3}/', ' ', $str,-1,$n);
$n += str_word_count($str);
return $n;
}n=1' type=text/javascript>n=1' type=text/javascript>
ob_clean();//加上这句
header("Content-type: image/png");
$font = "c:/windows/fonts/simsunb.ttf";
$img = imagecreate(110, 20) or die("GD图像创建失败!");
$bg = imagecolorallocate($img, 255, 255, 255);
$text_color = imagecolorallocate($img, 55, 55, 55);
imagestring($img, 5, 0, 3, "I'm leo...
有一个需求:
n_book 是所有参与限时免费的数据,free_days字段是免费天数,前端要显示具体的每个人截止时间,截止时间是从这个人开始阅读这本书开始算,如果没有阅读过,就按当前服务器时间加上天数然后转换成截止时间。
当一个人阅读了这本书,数据则会写入到n_free_days里,字段如下:
id,add_time,e...
日志写入
$path = './log/';
mkdir($path);
chmod($path, 0777);
$file = 'access_token.txt';
$filename = touch($path.$file);
chmod($path.$file, 0777);
$writeTime = date('Y:m:d h:i:s',time());
file_put_contents($path.$file, $writeTime." ".$data."\n",FILE_APPEND); //最后这个参数是追加的意思...
// utf8
function mb_unserialize($serial_str) {
$serial_str= preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str );
$serial_str= str_replace("\r", "", $serial_str);
return unserialize($serial_str);
}
// ascii
function asc_unserialize($serial_str) {
$serial_...
从现在起,到往前计算一周(七天,细到分秒)
$week = $endtime = strtotime(date("Y-m-d H:i:s",strtotime("-7days",strtotime("now"))));
红色代表你想计算的天数。往前往后都可以计算。strtotime是把格式化的时间转成时间戳。
//时间差
function time2Units ($time)
{
$year = floor($time / 60 / 60 / 24 / 365);
$time -= $year * 60 * 60 * 24 * 365;
$month = floor($time / 60 / 60 / 24 / 30);
$time -= $month * 60 * 60 * 24 * 30;
$week = floor($time / 60 / 60 / 24 / 7);
$time -= $week * 60 * 60 * 24 * 7;
$day = floor...
