从URL获取字符串而不使用斜杠

时间:2016-05-23 08:20:35

标签: php

我有一个类似gradle-experimental的网址。

如果点击了链接,我想要获取http://localhost/m/2016/05/05/sebut-gubernur

2 个答案:

答案 0 :(得分:0)

// This is the override
doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
    if (request has param I'm looking for) {
        // This says, "perform the authentication"
        super.doFilter(request, response, chain)
    }
    else {
        // This says, "skip this part of the filter chain"
        chain.doFilter(request, response)
    }
}

答案 1 :(得分:0)

$part = explode("/", urldecode($_SERVER['REQUEST_URI'])); echo $part[(count($part) - 1)]; //sebut-gubernur 变量可以帮助你。并且还会爆炸功能。

.htaccess
  

注意:此类网址还需要sebut-gubernur代码。

OR

如果您将链接作为字符串并希望获得$link = 'http://localhost/m/2016/05/05/sebut-gubernur'; $part = explode("/", urldecode($link)); echo $part[(count($part) - 1)]; //sebut-gubernur ,请尝试:

String dateString = "Sun Apr 15 13:37:33 CEST 2012";
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
System.out.println(sdf.parse(dateString));