우리가 URL을 :확인 현재 URL
내가
/posters/fixed/
이 (열 페이지) 현재의 URL에있는 경우 어떻게 알 수 있습니까 http://site.com/movies/posters/ID.html
http://site.com/movies/posters/fixed/ID.html
?
처럼 :
if ("/posters/fixed/" present) {
$match_fixed = true;
}
감사합니다.
우리가 URL을 :확인 현재 URL
내가
/posters/fixed/
이 (열 페이지) 현재의 URL에있는 경우 어떻게 알 수 있습니까 http://site.com/movies/posters/ID.html
http://site.com/movies/posters/fixed/ID.html
?
처럼 :
if ("/posters/fixed/" present) {
$match_fixed = true;
}
감사합니다.
if(strpos($_SERVER['REQUEST_URI'],"/movies/posters/fixed/")===0){
//true
}
(는 preg_match ("// 포스터/고정은 /"는 $ _SERVER [ 'REQUEST_URI는'])) ...
당신이 파일이 존재하는지 확인하고 싶은 경우에, 당신은 간단하게 할 수있는 경우 file_exists()
으로 전화하십시오.
if (file_exists("./movies/posters/fixed/ID.html") && is_file("./movies/posters/fixed/ID.html")) {
$match_fixed = true;
}
PHP 파일을 서버 루트 디렉토리에 복사합니다. 당신은 당신이 (그들은 정말 PHP 파일입니다 가정보고 된 파일에 액세스하는 데 사용되는 URL을 확인하려면, 당신은 그들에 액세스하는 데 사용되는 URL을 확인하도록 내부 코드를 넣으면
, 다음 코드는 작동 :
if (strpos($_SERVER['REQUEST_URI'],"/posters/fixed/") === 0) {
$match_fixed = true;
}
다른 의미가있는 경우 질문을 확장하여 의미를 분명히하십시오.