11 2016 档案
摘要:trim() trim() 函数移除字符串两侧的空白字符或其他预定义字符。 移除字符串两侧的字符("Hello" 中的 "He" 以及 "World" 中的 "d!"): trim($checked_sx, '_'); //去掉两侧的_ ltrim() rtrim则分别是去掉右侧和左侧的空白或指定字
阅读全文
摘要:HTML: <input type="file" name="address" onchange='PreviewImage(this)' value=""/> PHP: print_r($_FILES); echo "<br/>"; print_r($_FILES['address']); ech
阅读全文
摘要:LIKE “%a%b%c%”,这样匹配出的就是包含a,b,c三个关键词的记录 (三个关键词不在一起时) 不好用 mysql> select count(1) from dm_addr where addr like '%海口市%' and addr like '%振兴路%'; 我们写SQL语句的时候
阅读全文
摘要:php递归获取顶级父类id function get_top_parentid($id){ $r = M('navclass')->where('id = '.$id)->field('id,f_id')->find(); if($r['f_id'] != '0') return get_top_p
阅读全文
摘要:strpos — 查找字符串首次出现的位置 说明 int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) 返回 needle 在 haystack 中首次出现的数字位置。与 strrpos() 不同,在 PHP 5 之
阅读全文
摘要:$(".add_shuxing_ul > li:first") 选择class为add_shuxing_ul 的子级li元素的第一个li $(".add_shuxing_ul > li :first") (li后面有空格时) 选择class为add_shuxing_ul 的子级li元素的第一个后代元
阅读全文
摘要:通常在数据查询后都会对数据集进行分页操作,ThinkPHP也提供了分页类来对数据分页提供支持。 下面是数据分页的两种示例。 第一种:利用Page类和limit方法 第二种:分页类和page方法的实现 带入查询条件 如果是POST方式查询,如何确保分页之后能够保持原先的查询条件呢,我们可以给分页类传入
阅读全文
摘要:$info =M('productbase'); $info= $info->alias('a')->field('a.id,cid,title,address,protype,time,name,kucun,ifshowindex,price')->join('__NAVCLASS__ b ON
阅读全文
摘要:$("#add2sub").click(function(){ var $sxarr=$(".add_shuxing_ul > .sx_add_bg"); // alert($sxarr.eq(i).attr("id")); for(var i=0,len=$sxarr.length; i<len;
阅读全文
摘要:$("#sxselect").change(function(){ alert($("#sxselect option:selected").val()); }); jQuery("#select1 option:selected").text();
阅读全文
摘要:SQL: select * from table where id IN (3,6,9,1,2,5,8,7); SQL: select * from table where id IN ($str); //注意 $str为字符串,不是数组
阅读全文
摘要:function digui($idd) { $child = M('navclass')->where('f_id=' . $idd)->select(); $arr = array(); if (!empty($child)) { foreach ($child as $v) { $a.= $v
阅读全文
摘要:很多同学在学习递归函数的时候会感到头晕,无法搞清楚递归函数的原理和运行机制,本文将给大家详细讲解递归函数的运行机制和运用。 那什么是递归函数呢? 递归函数即为自调用函数,在函数体内直接或间接自己调用自己,但需要设置自调用的条件,若满足条件,则调用函数本身,若不满足则终止本函数的自调用,然后把目前流程
阅读全文
摘要:$news = M('productbase'); function digui($idd){ $child=M('navclass')->where('f_id='.$idd)->select(); // print_r($child); if(!empty($child)){ foreach($
阅读全文
摘要:type 字段 可能跟系统内置字段有冲突吧
阅读全文