2014年8月27日

php 身份证号检测

摘要: function idcard_verify_number($idcard_base){if (strlen($idcard_base) != 17){return false;}$factor = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, ... 阅读全文

posted @ 2014-08-27 11:31 chenzhaojx 阅读(429) 评论(0) 推荐(0) 编辑

php获取用户ip

摘要: function getip(){ if (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); //可伪造 } elseif (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HT... 阅读全文

posted @ 2014-08-27 11:26 chenzhaojx 阅读(286) 评论(0) 推荐(0) 编辑

sql 随机查询数据

摘要: SELECT {$field} FROM {$table} as t1 WHERE id IN ( SELECT t.id FROM (SELECT id FROM {$table} where 1=1 {$where} ORDER BY RAND() {$limit} ) AS t ) 阅读全文

posted @ 2014-08-27 11:24 chenzhaojx 阅读(368) 评论(0) 推荐(1) 编辑

php 二维数组排序

摘要: function array_sort($arr,$keys,$type='asc'){ $keysvalue= $new_array= array(); foreach($arr as $k=>$v){ $keysvalue[$k] = $v[$keys]; } if($type== ... 阅读全文

posted @ 2014-08-27 11:18 chenzhaojx 阅读(108) 评论(0) 推荐(0) 编辑

php 处理 json_encode 中文显示问题

摘要: /** * 对数组和标量进行 urlencode 处理 * 通常调用 wphp_json_encode() * 处理 json_encode 中文显示问题 * @param array $data * @return string */function wphp_urlencode($data) ... 阅读全文

posted @ 2014-08-27 11:15 chenzhaojx 阅读(365) 评论(0) 推荐(0) 编辑

php输出cvs文件,下载cvs文件

摘要: function outputCsv($data, $filename = 'file.csv') {//输出文件,下载文件 header('Content-Type:application/force-download'); header("content-Disposition:filename... 阅读全文

posted @ 2014-08-27 11:14 chenzhaojx 阅读(399) 评论(0) 推荐(0) 编辑

php服务器端生成csv文件

摘要: /** * 将数组动态输出至 csv 文件【服务器端生成文件】 * @param array $data 二维数组 * @param string $filename 文件名 */function writeCsv($data, $filename = 'file.csv') { $fp = fop... 阅读全文

posted @ 2014-08-27 11:12 chenzhaojx 阅读(505) 评论(0) 推荐(0) 编辑

php获取格式时间和时间戳

摘要: function get_intime($intime,$format){ if($intime==""){ return ""; } $format = isset($format)?$format:'Y-m-d H:i:s'; if(preg_match('/\d{10,}/is',$inti... 阅读全文

posted @ 2014-08-27 11:08 chenzhaojx 阅读(186) 评论(0) 推荐(0) 编辑

php压缩文件夹

摘要: function addFileToZip($path,$zip){$handler=opendir($path); //打开当前文件夹由$path指定。while(($filename=readdir($handler))!==false){if($filename != "." && $file... 阅读全文

posted @ 2014-08-27 11:04 chenzhaojx 阅读(563) 评论(0) 推荐(0) 编辑

php递归删除文件夹

摘要: function deldir($dir) { //先删除目录下的文件: $dh=opendir($dir); while ($file=readdir($dh)) { if($file!="." && $file!="..") { $fullpath=$dir."/".$fi... 阅读全文

posted @ 2014-08-27 11:03 chenzhaojx 阅读(117) 评论(0) 推荐(0) 编辑

php生成文件夹(递归生成)

摘要: function Mk_Folder($Folder){ if(!is_readable($Folder)){ Mk_Folder( dirname($Folder) ); if(!is_file($Folder)) mkdir($Folder,0777); }} php递归生... 阅读全文

posted @ 2014-08-27 10:56 chenzhaojx 阅读(242) 评论(0) 推荐(0) 编辑

导航