日常学习笔记:
1.php与java不同,方法名字相同即为同一个方法,不区别参数类型,个数,等。。。
2.php处理json:json_encode(),json_decode()。
3.对中文字符串进行编码:
URLEncoder.encode(String str,"utf-8");
URLDecoder.decode(String str,"utf-8");
4.js处理json:{"city":"beijing","age":24}
var json=eval("("+data+")");
json.city或json.age就可以了。
5.调用支付宝接口问题:
1.show_url,return_url,notify_url,不能跟自定义参数,(即不能跟问号后边的东西)。
2.支付宝接口核心生产表单函数,表单提交方式改为post。
6.FF和IE:
1.为了出现浏览器显示某个字段为空的情况,在页面显示的时候都加上 。
7.mysql数据库本身性能不好,尽量避开连表查询,可以用单表查询的两个集合合并来处理。
8.页面命名都用小写,action请求也都用小写,因为linux服务器下不认大写,区分大小写。
9.content.replace("\r\n","<br>");将字符穿换行的地方用换行符替换,一定是\r\n.
contentStr=contentStr. replaceAll("[\\s*\t\n\r]", ""); 空格,制表符,回车换行
10.mysql中的日期处理方法:
CURDATE():2012-04-26
(CURDATE() + 0):20120426
to_days(CURDATE()) - to_days('20120426')
DATE_FORMAT(NOW(),"%Y%m")
FROM_UNIXTIME(created/1000,'%Y-%m-%d %h:%m:%s')
DATE_FORMAT(LEFT(FROM_UNIXTIME(created/1000),10),'%Y%m%d')=20130621
11.java与数字签名::
http://www.blogjava.net/sylilzy/articles/javaadndigtalsign.html
http://www.doc88.com/p-49237539126.html
12.查询sql:
select sum( (case subject when 1 then 1 else 0 end) or (case subject when 7 then 1 else 0 end)) as `leave`,count(1) as talk,`day`,cid,sid from system_message where year=2013 and month=4 and day=17 GROUP BY cid,sid
select sum(( subject=1) or (subject=7 )) as `leave`,count(1) as talk,`day`,cid,sid from system_message where year=2013 and month=4 and day=17 GROUP BY cid,sid
select c.cid,c.companyname,c.itemname,c.c_uid,c.c_itemid,cp.extnum,cp.phone,cp.otherphone,cs.value from company c
left join companyphone cp on c.cid=cp.cid
left join (select cs.cid,cs.value from csettings cs where cs.`key` = 'freecall') cs on c.cid= cs.cid
读文件:
13:public class analysePhoneUtil {
public static List<String> anaysePhone() throws IOException{
List<String>phones=new ArrayList<String>();
String temp = null;
InputStream in = analysePhoneUtil.class.getClassLoader().getResourceAsStream("phone.txt");
BufferedReader reader;
reader = new BufferedReader(new InputStreamReader(in, "utf-8"));
while((temp = reader.readLine())!=null){
if(temp!=null){
phones.add(temp.trim());
}
}
return phones;
}
}
14:格式化时间
System.out.println(String.format(".%1$tY%1$tm%1$td%1$tH%1$tM%1$tS", new Date()));//.20131210135553
String str = String.format("%1$tF %1$tT", new Date());//2013-12-10 13:55:53