Use of undefined constant DIR_INCLUDE after redirect-Collection of common programming errors
I have wriiten a index.php in my root directory(i.e. classroom folder in my case).which is supposed to be the only entry path of my website.
first few lines of my index.php is
index.php
the problem is solved when i am including home.html.php in my index.php.but then its not following the url like localhost/classroom/home its always remaining as localhost/classroom.
QUESTION :why this error is coming??how to solve it by keeping the url like localhost/classroom/home
EDIT: i think there is some misinterpretation.my question is how can i solve the problem while it will keep the url as localhost/clasroom/home…and if i include all dir definition in every script then same way i will alsso be needed to include session_start() in every script..my question is if i do so will it then hold single entry path concept.because i want to maintain the single entry path
-
Your problem is that you’re mixing responsibilities.
index.php
should not contain bootstrap events, including that constant definitions.bootstrapper
should always be separated file, in most cases it should define only common constants and init common variables as well.That’s just a demonstration to make it work. In real-world you should not code this way. Learn about
SOLID
principles,OOP
andMVC
Originally posted 2013-11-10 00:14:19.