Есть ли динамический способ потребовать/включить файл php? ⇐ Php
-
Anonymous
Есть ли динамический способ потребовать/включить файл php?
Im developing a rest API using PHP and I needed to use a file in two differents endPoints. In the case I have a Login/Register endpoint and a Orders endpoint that are using my tokenService that I'm showing bellow.
The problem is that my structure of folders make the
require_once('../../index.php') work only when requiring the token service by the auth endpoints, because they're in Src/Routes/Auth folder, and work with
require_once('../index.php') when accessed by the order endpoint, which is just in Src/Routes.
Источник: https://stackoverflow.com/questions/780 ... a-php-file
Im developing a rest API using PHP and I needed to use a file in two differents endPoints. In the case I have a Login/Register endpoint and a Orders endpoint that are using my tokenService that I'm showing bellow.
The problem is that my structure of folders make the
require_once('../../index.php') work only when requiring the token service by the auth endpoints, because they're in Src/Routes/Auth folder, and work with
require_once('../index.php') when accessed by the order endpoint, which is just in Src/Routes.
Источник: https://stackoverflow.com/questions/780 ... a-php-file