dar Página URL


/ Published in: PHP
Save to your folder(s)

Al final esta la de dar la url donde estoy


Copy this code and paste it in your HTML
  1. function darURLPagInicio() {
  2.  
  3. $pagURL = 'http';
  4.  
  5. //Si la variable https está definida...
  6. if (isset($_SERVER["HTTPS"]))
  7. {
  8. //Si fue un pedido https entonces agregueles s a la url
  9. if ($_SERVER["HTTPS"] == "on") {$pagURL .= "s";}
  10. }
  11.  
  12. //Agregue el nombre del servidor donde se está ejecutando el script actual. Si está remoto entonces será localhost
  13. $pagURL .= "://".$_SERVER["SERVER_NAME"];
  14.  
  15. //Si el puerto del servidor es diferente de 80...
  16. if ($_SERVER["SERVER_PORT"] != "80") {
  17. //Agreguele el puerto del servidor a la url
  18. $pagURL .= ":".$_SERVER["SERVER_PORT"];
  19. }
  20.  
  21. //la ubicación de la página principal en el proyecto
  22. $pagURL .= .$_SERVER["REQUEST_URI"];
  23. // $pagURL .= .$_SERVER["PHP_SELF"]; pa q me de sin parámetros pasados por get
  24.  
  25. return $pagURL;
  26. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.