에릭 @ EricBess WebHome

그냥 생각보다는, 모르는 것이 의미

Chinese (Simplified) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag
By N2H

FindRelativePath 함수 [path는 상대적인 관계를 찾아내]

PHP 함수 : 경로 사이의 상대를 찾을 수있다.
PHP 함수 : 친척 관계 사이의 경로를 찾을 수있습니다.

예 :

? [클립 보드로 복사]는 PHP 코드보기
 1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
  <? PHP는 
  'http://www.php.net/manual/en/install.php' ; $ path_a = 'http://www.php.net/manual/en/install.php'; 
  'http://www.php.net/downloads' ; $ = path_b 'http://www.php.net/downloads'; 

  Path A:  " . $path_a ; "\ n 경로 :"에코. $ path_a; 
  Path B:  " . $path_b ; "\ n 경로 B 조 :"에코. $ path_b; 
  A to B:  " .  findRelativePath ( $path_a , $path_b ) ; //  ../../downloads/ "\ B에게 한 n 에코 :". findRelativePath ($ path_a, $ path_b); / / ... / ... / 다운로드 / 
  B to A:  " .  findRelativePath ( $path_b , $path_a ) ; //  ../manual/en/install.php A에게 "\ n B 조 :"에코. findRelativePath ($ path_b, $ path_a); / / ... / 설명서 / 영 / install.php를 
  ?> 

기능 :

? [클립 보드로 복사] 다운로드 FRPath.php
 1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
 32 
 33 
 34 
 35 
 36 
 37 
  <? PHP는 
  $path_1 , $path_2 ) 함수 findRelativePath ($ path_1, $ path_2) 
  ( 
      $path_1 == "" || $path_2 == "" ) ($ path_1 == ""| | $ path_2면 == "") 
      ( 
          ; 돌아 거짓; 
      ) 

      "/^(\\/|\w:\\/|https?:\\/\\/[^\\/]+\\/)?(.*)$/i" , $path_1 , $matches_1 ,  PREG_SET_ORDER ) ; 는 preg_match_all ( "/ ^ (\ \ / | \ 승 : \ \ / |은 https? : \ \ / \ \ / [^ \ \ /] + \ \ /)?(.*)$/ 난", $ path_1, $ matches_1, PREG_SET_ORDER); 
      "/^(\\/|\w:\\/|https?:\\/\\/[^\\/]+\\/)?(.*)$/i" , $path_2 , $matches_2 ,  PREG_SET_ORDER ) ; 는 preg_match_all ( "/ ^ (\ \ / | \ 승 : \ \ / |은 https? : \ \ / \ \ / [^ \ \ /] + \ \ /)?(.*)$/ 난", $ path_2, $ matches_2, PREG_SET_ORDER); 

      $matches_1 [ 0 ] [ 1 ] != $matches_2 [ 0 ] [ 1 ] ) ($ matches_1 [0] [1] 만약! = $ matches_2 [0] [1]) 
      ( 
          ; 돌아 거짓; 
      ) 

      explode ( "/" , $matches_1 [ 0 ] [ 2 ] ) ; $ path_1_parts 폭발 = ( "/", $ matches_1 [0] [2]); 
      explode ( "/" , $matches_2 [ 0 ] [ 2 ] ) ; $ path_2_parts 폭발 = ( "/", $ matches_2 [0] [2]); 

      isset ( $path_1_parts [ 0 ] ) && isset ( $path_2_parts [ 0 ] ) ) (isset ($ path_1_parts [0]) & & isset ($ path_2_parts하면서 [0])) 
      ( 
          $path_1_parts [ 0 ] != $path_2_parts [ 0 ] ) ($ 경우 path_1_parts [0]! = $ path_2_parts [0]) 
          ( 
              휴식 시간; 
          ) 

          $path_1_parts ) ; ($ path_1_parts) array_shift; 
          $path_2_parts ) ; ($ path_2_parts) array_shift; 
      ) 

      $i = 0 , $path = "" ; $i < count ( $path_1_parts ) - 1 ; $i ++ ) ($ 위해 전 = 0, $ 경로 = ""; $ i가 <() - 1; $ 나 + +) $ path_1_parts 카운트 
      ( 
          "../" ; $ 경로 .= "../"; 
      ) 
      . implode ( "/" , $path_2_parts ) ; 경로 $ 반환합니다. ( "/", $ path_2_parts) 내파; 
  ) 
  ?> 
1 Star2 Stars3 Stars4 Stars5 Stars (아직 등급이 없음)
Loading ... 로딩 ...
이 기사에 대한 - 환영 등급

로그 - 관련

이 신문에서는 독자는 또한 다음에 대해 우려하고있다 :

  • N / 한

7 월, 2008 17 저자 : 에릭 | 코딩 | 트랙백? | 2 코멘트 | Email This Post Print This Post | 45 조회

코멘트 추가

회신을 남겨주세요

게시물에 덧글 숨기기
  1. Traver 2008년 9월 2일에 다음 게시 오전 12:04시.

    난 - 무슨 연임에 문제는 아래의 코드 편집기 플러그인 감사에게 묻고 싶다

    대답
    1. 에릭 2008년 9월 2일에 다음 게시 오전 12:41시.

      wp를 - codebox

      대답