http://mooc.study.163.com/learn/HIT-1000002010?tid=1000003008#/learn/content?type=detail&id=1000115062里面有现成的代码