-
how to include classes and objects dynamically in php
Hello, Can any one tell me the concept of including classes and instance/ objects dynamically.
-
-
A. If you wanted to know about php serialisation/unserialisation to save objects in databases and use them dynamically,please read more about it.
B. If you wanted to know about including classes and auto loading them, please read about these methods.
a. spl_autoload_register('autoloading method name',false);
b. function __autoload($class) {
if(is_file($class . '.php')){
require_once $class.'.php';
}else{
printf("Error when trying to load %s", $class);
}
}
$okObj = new okClass();
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks