摘要: SELECT `id` FROM `topic` WHERE `id` IN ('444','512','447','509','504','445','511') ORDER BY FIELD(id,444,512,447,509,504,445,511) SELECT `id` FROM `to 阅读全文
posted @ 2017-04-17 13:49 朴一辰 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 许多人都说 算法是程序的核心,一个程序的好于差,关键是这个程序算法的优劣。作为一个初级phper,虽然很少接触到算法方面的东西 。但是对于冒泡排序,插入排序,选择排序,快速排序四种基本算法,我想还是要掌握的。下面是我按自己的理解,将四个方法分析一遍。需求:分别用 冒泡排序法,快速排序法,选择排序法,插入排序法将下面数组中 的值按照从小到的顺序进行排序。$arr(1,43,54,62,21,66,32,78,36,76,39);1. 冒泡排序法* 思路分析:法如其名,就是像冒泡一样,每次从数组当中 冒一个最大的数出来。* 比如:2,4,1 // 第一次 冒出的泡是4* 2... 阅读全文
posted @ 2014-04-04 13:19 朴一辰 阅读(168) 评论(0) 推荐(0) 编辑
摘要: if ($date != '') { switch($date){//date_add 加 date_sub 减 case '今天': $where .= " AND FROM_UNIXTIME(starttimefrom,'%Y-%m-%d') = curdate() "; break; case '明天': $where .= " AND FROM_UNIXTIME(starttimefrom,'%Y-%m-%d') = date_add(curdate(), interval 1 阅读全文
posted @ 2014-03-19 13:15 朴一辰 阅读(620) 评论(0) 推荐(0) 编辑
摘要: 1 0, 'msg' => '采集图片仅支持http协议'); 18 } 19 //url validate 20 $url = filter_var($url, FILTER_VALIDATE_URL); 21 if (!$url) { 22 return array('res' => 0, 'msg' => 'url地址无效'); 23 } 24 //host filter 25 $host = strtolower(parse_url($url, ... 阅读全文
posted @ 2013-12-10 17:03 朴一辰 阅读(316) 评论(0) 推荐(0) 编辑
摘要: MySQL 4.1中新增了FOUND_ROWS()函数,关于这个函数的说明如下:For a SELECT with a LIMIT clause, the number of rows that would be returned were there no LIMIT clauseA SELECT statement may include a LIMIT clause to restrict the number of rows the server returns to the client. In some cases, it is desirable to know how many 阅读全文
posted @ 2013-09-22 12:03 朴一辰 阅读(498) 评论(0) 推荐(0) 编辑
摘要: http://wbotelhos.com/raty 阅读全文
posted @ 2013-07-24 13:22 朴一辰 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 在本文中列出了21个值得收藏的Javascript技巧,在实际工作中,如果能适当运用,则大大提高工作效率。1 Javascript数组转换为CSV格式首先考虑如下的应用场景,有一个Javscript的字符型(或者数值型)数组,现在需要转换为以逗号分割的CSV格式文件。则我们可以使用如下的小技巧,代码如下:varfruits=['apple','peaches','oranges','mangoes']; varstr=fruits.valueOf();输出:apple,peaches,oranges,mangoes其中,value 阅读全文
posted @ 2013-07-24 12:56 朴一辰 阅读(220) 评论(0) 推荐(0) 编辑
摘要: php教程判断远程图片是否存在 function img_exits($url) { $ch = curl_init(); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_nobody, 1); // 不下载 curl_setopt($ch, curlopt_failonerror, 1); curl_setopt($ch, curlopt_returntransfer, 1); if(curl_exec($ch)!==fal... 阅读全文
posted @ 2013-07-12 16:49 朴一辰 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 这是一个PHP获取客户端IP所在地区的类,它能根据IP地址查地区,简单实用。使用示例示例一:$IpLocation = new IpLocation();$client = $IpLocation->getlocation();print_r($client);示例二:$IpLocation = new IpLocation('../qqwry/QQWry.Dat');$client = $IpLocation->getlocation('115.148.101.72');print_r($client);相关说明此类要求提供纯真IP数据库,附件包里 阅读全文
posted @ 2013-07-11 13:43 朴一辰 阅读(531) 评论(0) 推荐(0) 编辑
摘要: 浏览器默认强制不换行输出pre标签里面的内容,代码一长就导致文字撑出页面的问题解决方法:pre{ white-space:pre-wrap; /* css-3 */ white-space:-moz-pre-wrap; /* Mozilla, since 1999 */ white-space:-pre-wrap; /* Oper 4-6* / white-space:-o-pre-wrap; /* Opera 7 */}* html pre{ word-wrap:break-word; /* Internet Explorer 5.5+ */ white-space:normal; /* . 阅读全文
posted @ 2013-07-01 14:21 朴一辰 阅读(268) 评论(0) 推荐(0) 编辑