Answer the question
In order to leave comments, you need to log in
How to declare a class function outside the class or inside __construct()?
Such task interests:
There is a certain class which will be modified each time. And to make it easy to do, I decided to separate the class functions into different folders.
config (главная папка)
-- link (папка функции для работы с link)
-- title (папка функции для работы с title)
__construct()
or outside the class itself, I load each file. But I don't know how to declare a function for this class to make this code work:Class config {
function __construct(){
// здесь подгружаются файлы
}
}
// или подгружать здесь
$config = new config();
$config->getLink('protocol');
$config;
Answer the question
In order to leave comments, you need to log in
there is no such crutch that a pkheshnik cannot come up with.
- create a base abstract class, from which you inherit further
- https://ru.wikipedia.org/wiki/Decorator_(template_pr...
- runkit
- answer D' Normalization
but all this in this case did not fucking fall: it's more convenient to edit the class ( with autocomplete and other goodies), and not 100,500 separate functions, spread evenly on the disk.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question