A
A
Andrew2018-03-25 20:04:54
PHP
Andrew, 2018-03-25 20:04:54

How to modify the require or require_once connection flow?

Hello. There is a task: It is
necessary when connecting a file through requireor require_oncemodifying the data inside. Modification should occur at the time of connection. The original files must not be modified.
Previously, a function was used for this task, evalbut it brings too many problems.
Are there any filters or modifiers?
PS
Thanks in advance!
PPS
We can put the question this way - how to modify the PHP execution flow? (Without extra libraries, using PHP tools)
You need to pull the data from the execution thread, modify it and write it to the thread that will execute it. This is something like a file filter.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2018-03-25
@SilenceOfWinter

To insert the so-called phtml or in general some popular template engine to connect, I recommend fenom , it works very fast.

S
Sanovskiy, 2018-03-28
@Sanovskiy

In general, as I wrote above, Reflection or nikic / php-parser

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question