Is it a good practice to bootstrap your PHP application? I found two ways to bootstrap my PHP application. Some suggestions are needed which is a better way.
First of all.
Define a constant for folder structures
$ controllerPath = 'controller'; Define ('Controller', str_replace ('\\', '/', actual path ($ controller text)). '/'); // use require_once controller 'Somecontroller.php'; Includes path of application root in set up using
second
ini_set
$ rootpass = $ _SERVER ['DOCUMENT_ROOT']; $ IncludePath = ini_get ('include_path'); Ini_set ('include_path', '.' PATH_SEPARATOR $ root path.PATH_SEPARATOR. $ IncludePath); // use require_once 'controller / somecontroller.php';
Please tell me which is the better way.
Which would be the best way in the case of high-load applications ??
Use the in-directory-application to set up the in-directory . This is the reason why you can use the literal string in your required statements, besides it makes it easy to use the reuse code.
'coolapp / class / model.php' Requires 'coolerapp / display / router.fp' required 'spinoff / display / jsview.php' // etc.
Its completely com.whatever. App.more
is similar to idea in Java to be importable, or how all in the dragon
re: high load app Ation
Unless you are loading several thousand files, it takes time, files are probably not a bottle neck but, if this was the case then you have some options There is an APC, which caches the results of included
in memory. Second, to load everything from a file, as Javascript files are added together for better performance (coincidence) From, the APC has such a function Land which gives you this information). The APC is really easy to set up and is completely transparent to promote.
Comments
Post a Comment