php - Avoiding including abstract class in a general 'bootstrap' file
Get the solution ↓↓↓Solution:
First off - it's generally a good idea to stick to one class per file. If you're worried about performance, you're being paranoid. In production, you can always turn on APC with stat off.
Secondly - there's nothing wrong with include_once/require_once.
Unless you're going to set up some fancy autoloading magic, just stick to one class per file.
Absent some specific concern (that is, something articulable that you actually understand, not just some rumor you heard), the following pattern is perfectly fine:
<?PHP
require_once 'MyAbstract.class.php';
class Concrete extends MyAbstract {
//...
}
// end-of-file
Answer
Solution:
PHP's Autoloading mechanism could be ideal for you.
That said, there's nothing wrong withinclude_once()
. What that person talking about a design flaw was probably referring to is that a code flow that includes the same file more than once (thus makinginclude_once()
necessary overinclude()
is most likely badly designed.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: illuminate\http\exceptions\posttoolargeexception
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.