起风了

“路海长 青夜旷 越过群山追斜阳”

php 订单导出到excel表格及乱码问题

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...

app接入银联支付,在生产环境中出现订单无效或已失效[8100009]

银联支付订单无效或已失效 首先,我已经确定你已经把那证书弄好了,也放入了你的系统里,要不然你在请求支付获取支付参数时就失败了。 出现这个错误是需要客户端把测试模式改成生产模式: 银联支付报错8100009 这样改了后,就可以成功支付了。 —————————————————————— 银联app支付成功后,后台回调的处理 在...

thinkphp 批量更新

/** * 批量更新数据 * @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) { ...

php 计算中文字数

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>

php gd函数无法生成图片的问题

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...

mysql联表查询去掉主表里不符合子表数据的

有一个需求: n_book  是所有参与限时免费的数据,free_days字段是免费天数,前端要显示具体的每个人截止时间,截止时间是从这个人开始阅读这本书开始算,如果没有阅读过,就按当前服务器时间加上天数然后转换成截止时间。 当一个人阅读了这本书,数据则会写入到n_free_days里,字段如下: id,add_time,e...

linux 新建文件及文件夹

日志写入 $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);   //最后这个参数是追加的意思...

php unserialize反系列化后为空处理

// 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_...

php 时间差显示,适用于活动商品还剩下多少时间

//时间差 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...