R
R
Roman Dershavin2021-06-29 16:29:39
PHP
Roman Dershavin, 2021-06-29 16:29:39

How to import a php file so that only php is imported without html?

Hi everyone again!
i have two files, let's say index.php and config.php. In index.php there is both php code and HTML markup, when I import the index.php file from config.php, even the markup is imported, but how can I import so that only php is imported?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2021-06-29
@Stalker_RED

The markup is taken out in separate files.

I have training - a project, a PHP dock and that's it.

The php doc has a set_error_handler that will catch most errors, and almost all the rest can be caught using the register_shutdown_function.
After your error handler is triggered, calling debug_backtrace or Exception ->getTrace will not only allow you to see which line the error occurred on, but will show what happened before the error - which functions were called and with what parameters.
Have fun.
(yes, there are, of course, ready-made libraries for error handling, but for learning purposes, you can also write a bicycle)

A
Alex, 2021-06-29
@Kozack

Well, you have to move what needs to be imported separately from the markup into a third file. And import everything from the third file to both index and config

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question