Eric @ EricBess WebHome

Gana no arrogante, no perder de hambre, no hay choque de pecho y la cara, como el mío Pinghu

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

Función FindRelativePath [ruta de acceso para averiguar la relación entre la relativa]

Php function: Se han encontrado relación entre el la ruta de acceso.
Función de PHP: para encontrar el camino entre la relativa relación.

Ejemplo:

? [Copiar al portapapeles] Ver código 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 ; echo "\ n Ruta A:". path_a $; 
  Path B:  " . $path_b ; echo "\ n Ruta B:". path_b $; 
  A to B:  " .  findRelativePath ( $path_a , $path_b ) ; //  ../../downloads/ echo "\ n A a B:". findRelativePath ($ path_a, $ path_b); / / .. / .. / descargas / 
  B to A:  " .  findRelativePath ( $path_b , $path_a ) ; //  ../manual/en/install.php echo "\ n B a A:". findRelativePath ($ path_b, $ path_a); / / .. / manual / es / install.php 
  ?> 

Función:

? [Copiar al portapapeles] Descarga 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 ) función findRelativePath ($ path_1, $ path_2) 
  ( 
      $path_1 == "" || $path_2 == "" ) if ($ path_1 == "" | | $ path_2 == "") 
      ( 
          ; return false; 
      ) 

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

      $matches_1 [ 0 ] [ 1 ] != $matches_2 [ 0 ] [ 1 ] ) if ($ matches_1 [0] [1]! = $ matches_2 [0] [1]) 
      ( 
          ; return false; 
      ) 

      explode ( "/" , $matches_1 [ 0 ] [ 2 ] ) ; $ Path_1_parts explotar = ( "/", $ matches_1 [0] [2]); 
      explode ( "/" , $matches_2 [ 0 ] [ 2 ] ) ; $ Path_2_parts explotar = ( "/", $ matches_2 [0] [2]); 

      isset ( $path_1_parts [ 0 ] ) && isset ( $path_2_parts [ 0 ] ) ) while (isset ($ path_1_parts [0]) & & isset ($ path_2_parts [0])) 
      ( 
          $path_1_parts [ 0 ] != $path_2_parts [ 0 ] ) if ($ path_1_parts [0]! = $ path_2_parts [0]) 
          ( 
              break; 
          ) 

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

      $i = 0 , $path = "" ; $i < count ( $path_1_parts ) - 1 ; $i ++ ) for ($ i = 0, $ path = ""; $ i <count ($ path_1_parts) - 1; $ i + +) 
      ( 
          "../" ; $ .= Camino "../"; 
      ) 
      . implode ( "/" , $path_2_parts ) ; return $ camino. implosión ( "/", $ path_2_parts); 
  ) 
  ?> 
1 Star2 Stars3 Stars4 Stars5 Stars (Sin clasificación todavía)
Loading ... Cargando ...
- Acogió con beneplácito la calificación para este artículo

Relacionados con el registro de

En este documento, los lectores también están preocupados por el texto siguiente:

  • N / A

17 de julio, 2008 Autor: Eric | Codificación | Trackback | 2 comentarios | Email This Post Print This Post | 39 visitas

Añadir un comentario

Deje una respuesta

Ocultar enviar comentarios
  1. Traver publicado lo siguiente en 2008-09-02 a horas 12:04.

    Me gustaría preguntar al editor de código plug-in lo que se puede lograr en virtud de la molestia de decirle Gracias

    Responder
    1. Eric publicado lo siguiente en 2008-09-02 a horas 12:41.

      wp-codebox

      Responder