You are here: Re: session_start and __autoload() « PHP Programming Language « IT news, forums, messages
Re: session_start and __autoload()

Posted by Giacomo on 03/08/07 10:44

On 8 Mar, 10:21, "Martin Mandl - m2m tech support"
<martin.ma...@gmail.com> wrote:
> On Mar 8, 4:46 am, Hendri Kurniawan <ask...@email.com> wrote:
>
>
>
> > Giacomo wrote:
> > > Hi all.
> > > I just don't understand the behaviour of this: i have a few-webpages
> > > application in which I have these two files (and all the others)
>
> > > classes/class.User.php
> > > include/stdinclude.php
>
> > > the code of stdinclude.php is the following:
>
> > > <CODE>
> > > ...
> > > session_start();
>
> > > function __autoload( $classname ) {
> > > require_once "../classes/class.$class_name.php";
> > > }
> > > ...
> > > </CODE>
>
> > > I was getting the require_once-fatal-error becouse the script couldn't
> > > find "../classes/class.User.php", and I tried to understand where the
> > > include path pointed to: so i dumped the stacktrace and that's what
> > > was in:
>
> > > this never happends to me before; is this a correct php behaviour ?
> > > should I fix with an absolute path ?
>
> > > tnx, bye
> > > M
>
> > Try using dirname(__FILE__).
> > So: require_once dirname(__FILE__)."/../classes/class.$class_name.php";
>
> > Hendri
>
> Dear Giacomo,
>
> the path for require_once() is relative to the initial file, e.g.
>
> 1) dummy.php -> include('include/stdinclude.php');
> 2) include/stdinclude.php -> require_once('classes/
> class.User.php'); // path is relative to dummy
> 3) classes/class.User.php
>
> I hope that helped
> Martin
>

Thanks everybody.. i was confused by the fact the if i do this it
works:

1) dummy.php -> include('include/stdinclude.php');
2) include/stdinclude.php -> require_once('bar.php');
3) include/bar.php

... and of course by the fact that it was 2.00 am o'clock ;)

thanks
bye
M'

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация