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]
|