note 97003 added to function.spl-autoload-register
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 27 Mar 2010 09:02:51 +0000 |
| Subject: | note 97003 added to function.spl-autoload-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167444@lists.php.net to get a copy of this message | ||
This fails everytime under PHP 5.3 with uncaught exception, Function auload not found. It only
works if last line is changed to
spl_autoload_register( '\henry\auload' );
and that seems just wrong because the first line should already put us within the "henry"
namespace, no?
<?php
namespace henry;
function auload( $ClassNameToLoad )
{
$classes = array(
'ClassName1' => 'Classes/ClassName1.php',
'ClassName2' => 'Classes/ClassName2.php',
);
if( $classes[ $ClassNameToLoad ] )
{
include( '/hd/path/'. $classes[ $ClassNameToLoad ] );
}
}
spl_autoload_register( 'auload' );
?>
----
Server IP: 192.41.40.227
Probable Submitter: 70.91.82.193
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload-register.php
Edit -- https://master.php.net/note/edit/97003
Del: integrated -- https://master.php.net/note/delete/97003/integrated
Del: useless -- https://master.php.net/note/delete/97003/useless
Del: bad code -- https://master.php.net/note/delete/97003/bad+code
Del: spam -- https://master.php.net/note/delete/97003/spam
Del: non-english -- https://master.php.net/note/delete/97003/non-english
Del: in docs -- https://master.php.net/note/delete/97003/in+docs
Del: other reasons-- https://master.php.net/note/delete/97003
Reject -- https://master.php.net/note/reject/97003
Search -- https://master.php.net/manage/user-notes.php