Reply to Re: session_start and __autoload()

Your name:

Reply:


Posted by Hendri Kurniawan on 03/08/07 03:46

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

[Back to original 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

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