Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Matthew Carter Newsgroups: comp.lang.php Subject: Re: Class 'Model' not found Date: Tue, 23 Aug 2016 01:23:03 -0400 Organization: Ahungry (http://ahungry.com) Lines: 41 Message-ID: <87shtwuki0.fsf@ahungry.com> References: <1563ad73-c46d-487f-84e0-a80a1217f2db@googlegroups.com> <1647269.ji5Ds1KI6Y@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="7c986cd4736462de309a749b207746fe"; logging-data="27801"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VswzsOf3+OmIzDhArDZ5U" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:Q+NxRNufhrLwk4V6k19f+f3fYAg= sha1:+r437B9C9ldxOWSdQ8+YP1n4gD0= Xref: csiph.com comp.lang.php:16974 Jerry Stuckle writes: > On 8/22/2016 2:56 PM, the troll Thomas 'Pointed Head' Lahn wrote: >> M desinger wrote: >> >>> Full code index.php >>> >>> >> >>> include './application/model/model.php'; >>> include './application/config/system.php'; >>> include './application/config/language.lv.php'; >>> >>> 12 line ---> $class = new Model(); >> >> The “include” should be “require_once”, so that you get a “Fatal error” if >> the inclusion fails, the error message telling you *why* “require_once” >> failed. “require_once” instead of “require” includes those files only once, >> which avoids all sorts of problems. >> >> In any case, the leading “./” is superfluous. >> >> Finally, one uses namespaces and autoloading these days; *all* kinds of >> includes (include, include_once, require, and require_once) are deprecated >> for loading class files like model.php. RTFM. >> > > You've obviously not had the autoloading function pick up the wrong > version of a class. But that's not surprising from you. You have > repeatedly shown you have no concept of good coding techniques, and have > probably never had two classes of ANY name on your system. Why would you have 2 identically named classes in the same namespace (if different namespaces, alias them)? If you're actually referring to 2 versions of the same class at different points in time, why not a VCS? -- Matthew Carter (m@ahungry.com) http://ahungry.com