2014-01-18 4 views

답변

1

서버 측 (php)에서 수행하려면 http://www.php.net/manual/en/reserved.variables.server.php을보십시오.

if($_SERVER['PATH_INFO'] === "/chat") { 
    // show the name 
} 

당신이 (javascript 포함) 클라이언트 측에서 그것을하고 싶은 경우에, 당신은 location.href 함께 할 수 있습니다 : 당신이 뭔가를 할 수 있습니다. ...

if(location.href.split(location.host)[1] === "/chat") { 
    // show the name 
} 
+0

을하지만이 페이지에서 찾고 이름을 어떻게 얻을 수 있습니다 : 여기 당신은 이런 식으로 할 수 있습니까? – Zolax

0

사용이 코드

myUrl = window.location.href;  // get the url 
lastWordInUrl = myUrl.substring(myUrl.lastIndexOf('/')+1,myUrl.length); // get last word of url 

if(lastWordInUrl == 'chat'){...do your stuff...} 
관련 문제