一、從mysql中選取某個欄位不重複的所有值
select *, count(distinct name) from table group by name
二、刪除指定的字段重複值,key1是第乙個字段,key2是第二個(先加識別符號,然後刪除-)
//去除指定的字段的重複值/**private functiondeleterepeat
($arr
,$key1
,$key2)}
else
//}}
}foreach(
$arr
as$key
=>
$val)}
$newarr
=array_filter(
$arr);
return$newarr
;}
* desription 壓縮
* @param sting $imgsrc 路徑
* @param string $imgdst 壓縮後儲存路徑
*///壓縮
private static function image_size_compress($imgsrc,$imgdst,$percent)
break;
case 2:
$image_wp=imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($imgsrc);
imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_wp, $imgdst,$percent);
print_r($imgdst."
");print_r($percent);
imagedestroy($image_wp);
break;
case 3:
$image_wp=imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefrompng($imgsrc);
imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_wp, $imgdst,$percent);
imagedestroy($image_wp);
break;
default:
break;}}
/*** desription 判斷是否gif動畫
* @param sting $image_file路徑
* @return boolean t 是 f 否
*/private static function check_gifcartoon($image_file)
//遞迴改變品質,將大小控制在500kb以下
private static function changesize($old,$new,$percent,$step)else
}//判斷修改畫質的初始百分比以及單步變化大小
public static function changeimage($old,$new)
//每次都先刪除中轉檔案
if(is_file($new))
image::changesize($old, $new, $percent, $step);}}
四、php7編譯的配置
./configure --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear --with-libdir=/lib/x86_64-linux-gnu --with-freetype-dir=/usr/local/include/freetype2/freetype/ --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --enable-xml
五、拆分字串為了顯示正常(一行漢字顯示9個而一行字母顯示18個這種問題)
functionclipstring($str
)-\x]+/u'
;$len=0
;//擷取字串的位置記錄,如果最後還是為0則證明沒有這麼長,就是不存在就不用來擷取了
$pos1=0
;$pos2=0
;foreach(
$strarr
as$k
=>
$val
)else
if(
$len
==18
||$len
==19
)else
$len=0
;}else
else
$len=2
;}}}
if(
$pos1==0
)if((
$pos1!=0
)&&(
$pos2==0
))if((
$pos1!=0
)&&(
$pos2!=0
))}//將字串分割成陣列
functiongetstrarr
($str
)return$strarr;}
$str
="aaa哈哈哈哈啊哈aaa哈哈aaaa哈哈哈aaa哈哈啊哈哈"
;$result
=clipstring(
$str);
print_r(
$result
);
PCB的GERBER的各層(半原創)
layer層 佈線層為銅箔走線 layer就是層的意思,但是這層卻沒名稱 silkscreen 絲印層,很好理解,印東西文字之類 solder mask 阻焊綠油層,是指板子上要上綠油的部分 因為它是負片輸出,所以實際上有soldermask的部分實際效果並不上綠油,而是鍍錫,呈銀白色!paste ...
噹噹工作1年半的體驗 原創
有得有失,總結 沒有發揮自己能力的平台和機會 1 噹噹在2006年融資2700萬美金後,終於擴大了技術部門的實力,開始大批招人,技術部包括新的cto戴總,搜尋團隊,net架構師,net開發工程師 2006年到現在噹噹經歷了快速發展的階段,聽老員工說這個階段是噹噹最重視技術的時候,這是好事。2 在這1...
半原創 核心中的資料結構 SplayTree
核心中的資料結構 splay tree splay tree 伸展樹 是binary search tree 二叉搜尋樹 daniel sleator和robert e.tarjan發明。但此操作可能會花費o n 時間,但m次操作的最壞情況為o m log2 n splay tree是在節點訪問後,...