资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

每日记载内容总结35-创新互联

1.js实现关闭浏览器当前窗口每日记载内容总结35
function closeWindow(){
var userAgent = navigator.userAgent;
if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Presto") != -1) {
            window.location.replace("about:blank");
        }else {
            window.opener= null;
            window.open("", "_self");
            window.close();
        }
    }

2.nginx 的测试,启动,停止与重启

成都创新互联-专业网站定制、快速模板网站建设、高性价比承德县网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式承德县网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖承德县地区。费用合理售后完善,十年实体公司更值得信赖。

测试:nginx -t (可检验配置文件等内容是否正确)

启动:直接点击Nginx目录下的nginx.exe   或者   cmd运行start nginx

关闭:nginx -s stop   或者   nginx -s quit (stop表示立即停止nginx,不保存相关信息   quit表示正常退出nginx,并保存相关信息)

重启:nginx -s reload

3.Restrictions.ilke与Restrictions.like的区别

前者可以忽略大小写查询 而后者类似于sql中的 like

如果是使用HQL,可以使用lower或者upper函数来实现

from User u where lower(u.username)=lower(’Mp3′)如果使用Criteria,首先使用Restrictions创建Criterion

如果是字符串相等匹配Restrictions.eq(’username’,'mp3′).ignoreCase()

如果是字符串模糊匹配Restrictions.ilike(’username’,'mp3′)或者Restrictions.like(’username’,'mp3′).ignoreCase()
(摘自百度知道)

4.hibernate实现模糊查询的方法:(来源:http://newleague.iteye.com/blog/953499)

(1)第一种方式:QBC查询(Expression.like)

String name= "", info = "";
if (sub != null && sub.getSubname() != null) {
name= sub.getSubname();
}
if (sub != null && sub.getSubinfo() != null) {
info= sub.getSubinfo();
}
Criteria cr= session.createCriteria(Subject.class);
cr.add(Expression.like("subname","%"+name+"%"));
cr.add(Expression.like("subinfo","%"+info+"%"));

(2)第二种方式:QBC查询(Restrictions.ilike)

cr.add(Restrictions.or(Restrictions.ilike("postTitle", getKeyword(),
                    MatchMode.ANYWHERE), Restrictions.ilike("postContent", getKeyword(),
                    MatchMode.ANYWHERE)));

(3)第三种方式:HQL查询语句

String   sql="";
sql= "from Pfapp  where name like :subname ";
Query query= session.createQuery(sql); 
query.setString("subname","%"+subnamevalue+"%");

5.使用Jsoup获取手机归属地信息

package test.data;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

public class GetData {
public static void main(String[] args) throws Exception{
        String result= getLocation("18385552222");
//根据返回的文本内容,获取手机归属地信息        System.out.println(result.replace("", "").replace(" ", " "));
    }
    
    
public static String getLocation(String phoneNum) throws Exception{
//从ip138网站请求并且获取信息        String url = "http://www.ip138.com:8080/search.asp";
//匹配返回的字符串标签        String titleCssQuery = "td.tdc2";
//传参数,action=mobile&moblie=手机号        Document document = Jsoup.connect(url).data("action", "mobile").data("mobile", phoneNum).get();
if(null == document){
return "";
        }
//对返回的页面内容进行指定标签的获取         Elements totalElement = document.select(titleCssQuery);
         String ele= totalElement.eq(1).html();
return ele;
    }
}

当前名称:每日记载内容总结35-创新互联
分享路径:http://cdkjz.cn/article/coepco.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220