Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16970

Re: Class 'Model' not found

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.php
Subject Re: Class 'Model' not found
Date 2016-08-22 20:56 +0200
Organization PointedEars Software (PES)
Message-ID <1647269.ji5Ds1KI6Y@PointedEars.de> (permalink)
References <b08fa2e1-a17e-4bdf-86e0-aa65f96eb98a@googlegroups.com> <1563ad73-c46d-487f-84e0-a80a1217f2db@googlegroups.com>

Show all headers | View raw


M desinger wrote:

> Full code index.php
> 
> <?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.

-- 
PointedEars
Zend Certified PHP Engineer 
<http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-21 07:35 -0700
  Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-21 07:36 -0700
  Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-21 07:43 -0700
    Re: Class 'Model' not found "J.O. Aho" <user@example.net> - 2016-08-21 18:08 +0200
      Re: Class 'Model' not found "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-08-21 19:36 +0200
    Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-22 20:56 +0200
      Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-22 19:08 -0400
        Re: Class 'Model' not found Matthew Carter <m@ahungry.com> - 2016-08-23 01:23 -0400
          Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-23 08:07 -0400
            Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-27 14:26 +0200
              Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-27 10:13 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-28 02:12 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-27 20:32 -0400
              Re: Class 'Model' not found Matthew Carter <m@ahungry.com> - 2016-08-28 00:00 -0400
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-28 08:40 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 11:39 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 07:41 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 14:41 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 09:02 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 15:36 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 10:39 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 11:35 +0200
  Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-30 14:25 -0700
    Re: Class 'Model' not found Gregor Kofler <usenet@gregorkofler.com> - 2016-08-31 00:35 +0200
      Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-30 16:34 -0700
        Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 19:58 -0400

csiph-web