M
M
Mikhail Lebedev2022-04-15 21:56:57
PHP
Mikhail Lebedev, 2022-04-15 21:56:57

Get path in php without index.php?

I prescribe the meta in the pages that are generated in different folders (the names of the folders are also different and not known).

$url = ((!empty($_SERVER['HTTPS'])) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

this displays the address of the current page with index.php
= https://site.ru/link/folder1/index.php

now the problem is how to display a link to an image that is in the same folder that is generated by the user

itself, this is not suitable because of the index .php at the end

?
how to remove from $url = ((!empty($_SERVER['HTTPS'])) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; index.php
or we can output it in some other way

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question