note 104187 added to language.oop5.autoload

From: Date: Tue, 31 May 2011 05:22:10 +0000
Subject: note 104187 added to language.oop5.autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-180111@lists.php.net to get a copy of this message
in my case i use config.php and put all the settings there including the _autoload functions. Just include the config.php in all of your php file. Heres how: config.php: <?php function _autoload($classname) { include_once("classfolder/" . $classname . ".php"); } ?> ClassFolder: with SampleClass.php <?php class SampleClass { public function hello_rahj() { echo "Hello rahj!"; } } ?> In your Typical Php File: e.g. Index.php <?php include("config.php") $hello = new SampleClass(); $hello->hello_rahj(); // outputs Hello rahj! ?> When using the _autoload functions, Make Sure you use a Proper naming Convention. Hope this Helps! ---- Server IP: 69.147.83.197 Probable Submitter: 112.202.116.204 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php Edit -- https://master.php.net/note/edit/104187 Del: integrated -- https://master.php.net/note/delete/104187/integrated Del: useless -- https://master.php.net/note/delete/104187/useless Del: bad code -- https://master.php.net/note/delete/104187/bad+code Del: spam -- https://master.php.net/note/delete/104187/spam Del: non-english -- https://master.php.net/note/delete/104187/non-english Del: in docs -- https://master.php.net/note/delete/104187/in+docs Del: other reasons-- https://master.php.net/note/delete/104187 Reject -- https://master.php.net/note/reject/104187 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180111) next »