Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
backend
php
oop
classes_objects
19load_autoload_try_catch.php
19load_autoload_try_catch.php
<?php function __autoload($class_name) { $class_name=strtolower($class_name); $put="./classlib/".$class_name.".class.php"; if(file_exists($put)) include($put); else throw new Exception("Ne moze se ucitati <b>$put</b> ili taj fajl ne postoji."); } //try-catch blok try { $obj = new Treca; echo $obj->sv2; //svojstvo druge klase $obj2=new MojaKlasa; //izbacuje gresku } catch (Exception $e) { echo $e->getMessage(); } ?>
Reload page
Preview
W3C validation
Edit Code