会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
alanlamp
博客园
首页
新随笔
联系
订阅
管理
2018年3月9日
php调用含有命名空间的类
摘要: 现有a.php 和 b.php在同一个目录下 a.php中 namespace myspace; class A{ __construct(){} .... } b.php中调用类A require_once('./a.php '); $obj = new \myspace\A();
阅读全文
posted @ 2018-03-09 16:09 AlanLeung
阅读(2058)
评论(0)
推荐(0)
2018年3月5日
SQL专题
摘要: 1. 值为null的字段,假如update table set a=a+1,则会报sql错误 2. //todo
阅读全文
posted @ 2018-03-05 17:25 AlanLeung
阅读(144)
评论(0)
推荐(0)
JavaScript专题
摘要: 1. 在ajax的任何回调方法中,比如success回调,使用return,将会无效 2. //todo
阅读全文
posted @ 2018-03-05 17:19 AlanLeung
阅读(128)
评论(0)
推荐(0)
HTML专题
摘要: 1. 在<form><form/>标签里面的<button>标签要设置type="button",否则可能会在点击按钮时自动提交这个表单 2. //todo
阅读全文
posted @ 2018-03-05 17:14 AlanLeung
阅读(204)
评论(0)
推荐(0)
ThinkPHP5专题
摘要: TinkPHP5中 1. model中select()后的查询结果是对象而不是数组 2. model中 假如有 $result=$this->field($fields)->where($condition)->order("id desc")->page($limit)->select(); 如果
阅读全文
posted @ 2018-03-05 17:12 AlanLeung
阅读(141)
评论(0)
推荐(0)
php截取中文字符串
摘要: string mb_substr ( string $str , int $start [, int $length = NULL [, string $encoding = mb_internal_encoding() ]] ) 根据字符数执行一个多字节安全的 substr() 操作。 位置是从
阅读全文
posted @ 2018-03-05 16:59 AlanLeung
阅读(409)
评论(0)
推荐(0)
跨域/非跨域接口专题
摘要: 跨域名的接口:A域名www.a.com请求B域名www.b.com的接口(域名可以换成ip地址,同样成立) 非跨域接口:A域名www.a.com请求A域名www.a.com的接口 对于跨域名的接口请求: 1. 如果是前端js请求,则需要使用AJAX+JSONP 2. 后端PHP请求可以用WebSer
阅读全文
posted @ 2018-03-05 16:50 AlanLeung
阅读(314)
评论(0)
推荐(0)
JS检查输入项是否为手机号码或者固话号码的正则表达式
摘要: var reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/; //校验手机号和固定电话 if ( !reg.test(shop_tel) || check_empty(shop_tel) ){ return alert("请输入正确的手机号"); }
阅读全文
posted @ 2018-03-05 16:42 AlanLeung
阅读(6761)
评论(2)
推荐(0)
TinkPHP去重统计查询
摘要: 当统计一个有重复的字段可以用这个方法 $count = $model->where($map)->count('distinct(id)'); 转自 http://www.thinkphp.cn/code/185.html
阅读全文
posted @ 2018-03-05 16:38 AlanLeung
阅读(252)
评论(0)
推荐(0)
2017年9月27日
模型类设计模式
摘要: 简单的增删改查放到BaseModel,复杂查询放到新建的model,这个新的model继承BaseModel
阅读全文
posted @ 2017-09-27 16:36 AlanLeung
阅读(154)
评论(0)
推荐(0)
下一页
公告