-
等比裁剪图片
等比裁剪图片
/** * @param $src_file 原图片路径 * @param $dst_file 新图片路径 * @param $new_width 宽度 * @param $new_height 高度 */ function image_resize($src_file, $dst_file, $new_width, $new_height) {...常用手册汇总
常用手册汇总
Electron 封装程序
electron 封装程序
数字转人民币大写
数字转人民币大写
``` if(!function_exists(‘convertAmountToCn’)){ /** * 将数值金额转换为中文大写金额 * @param $amount float 金额(支持到分) * @param $type int 转换类型,0:转换整数和小数;1:转换到整数 * @return mixed 中文大写金额 */ function convertAmountToCn($amount, $type = 1) { // 判断输出的金额是否为数字或数字字符串...
MySQL server has gone away 问题的解决方法
mysql出现ERROR : (2006, ‘MySQL server has gone away’) 的问题意思就是指client和MySQL server之间的链接断开了。
PHP BC高精确度函数库
``` #两个高精度数比较 int bccomp ( string $left_operand , string $right_operand [, int $scale ] ) #$left=$right 返回 0 #$left<$right 返回 -1 #$left>$right 返回 1 #$scale 小数点位数
正则案例
数据抓取
``` $url=”http://xukai1.qiyunapp.com/products/product-1002699.html”; $text=file_get_contents($url);//id="tabitem">(.?)<\/div>/is //取得所有img标签 preg_match_all(‘/<img[^>]>/i’, $text, $imgarray); preg_match_all(‘/img1="([^”])"/’,$text,$imglist_800); //返回所有图片的路径 preg_match_all(“/<[img|IMG].?src='|"['|"].?[\/]?>/”,$text,$match); //取得class为pdtname clear里面的内容 preg_match(‘/class="pdtname clear">(.?)<\/div>/is’,$text,$title); preg_match(‘/class="pdtdesc">(.?)<\/div>/is’,$text,$desc); preg_match(‘/id="marketprice">(.?)<\/span>/is’,$text,$market_price); preg_match(‘/id="memberprice">(.?)<\/span>/is’,$text,$shop_price); preg_match(‘/<img[^>]id="thumbnail_img"[^r]rc="([^”])"[^>]>/’,$text,$original_img); preg_match(‘/class="tabitem">(.?)<\/div>/is’,$text,$tabitem); $imglist=$imglist_800[1]; $value[‘title’]=trim($title[‘1’]);//商品名称 $value[‘goods_remark’]=trim($desc[‘1’]);//商品简介 $value[‘market_price’]=trim($market_price[‘1’]);//市场价 $value[‘shop_price’]=trim($shop_price[‘1’]);//售价 $value[‘original_img’]=trim($original_img[‘1’]);//产品缩略图 $value[‘imglist’]=$imglist;//商品相册 $value[‘goods_content’]=trim($tabitem[1]);//商品详情...
MySQL教程(转载)
SQL 基础使用
40/51