0
Consider the following html address:
http://exemplo.com/1/2/3/teste.php
I would like to indicate in the variable $ender
the absolute address of my scripts (including them) to be found independent of the change of address (from being at the root or subdirectory). I tried that "http://$_SERVER[HTTP_HOST]$SERVER[REQUEST_URI]"
to try to at least replace that: (http://exemplo.com/1/2/3/
). It didn’t work. What wanted to avoid the literality of everything (http://exemplo.com/1/2/3/teste.php
). I only had some partial success with http://$_SERVER[HTTP_HOST], but only replaces the base address.
<?php
error_reporting(E_ALL);
$host = $_SERVER['HTTP_HOST']$SERVER['REQUEST_URI']/;
$id = $_GET['id'];
if ($id == 1) {
You’re trying to interpolate that right into a string, that’s it?
$_SERVER['REQUEST_URI']
brings everything that comes after the (host) domain, that’s not what you need?– bfavaretto
I tried this but it didn’t work (if the way I described above is correct). tb didn’t get it with $_SERVER[DOCUMENT_ROOT]
– Antonio Oliveira
I just can’t figure out where the problem is. Show a piece of your real code, the way it’s in the question we don’t quite know what you’re doing
– bfavaretto
@bfavaretto, includes the code part of how I put the address.
– Antonio Oliveira