How to link a . php file to an HTML page?

Asked

Viewed 752 times

-1

The pages on my site are built like this: index.php (this is a file that only has "requires", that requires .php pages that have HTML, these pages will mount the page in question) one of the index requires (a file that is HTML, its extension is php) has a link that should call a file. php analog to index.php (a file that has "requires" and will therefore run on the server)

The problem I’m having is addressing: I don’t know how to put the address (I want it to be addressed from the root) in

See the image attached, I think the problem will become clearer. inserir a descrição da imagem aqui

  • It is not possible to put as href="<?= $_SERVER['DOCUMENT_ROOT'] ?>/fisica/curso..."> ?

1 answer

-1

Don’t need to put what comes before on the way, use the ./ current path, ie:

The current page is www.seusite.com/pagina and you use the <a href="./exemplo.php"></a>, click goes to www.seusite.com/pagina/exemplo.php

If using with two dots, the path will rewind a folder:

The current page is www.seusite.com/pagina and you use the <a href="../exemplo.php"></a>, click goes to www.seusite.com/exemplo.php

You can use you can use chain to get back more than one ex folder: ../../../exemplo

Browser other questions tagged

You are not signed in. Login or sign up in order to post.