Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases > Coding Snippets
You last visited: Today at 11:58

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[PHP] Load all files in directory (good for loading function files)

Discussion on [PHP] Load all files in directory (good for loading function files) within the Coding Snippets forum part of the Coding Releases category.

Reply
 
Old   #1



 
Shawak's Avatar
 
elite*gold: 0
The Black Market: 259/0/0
Join Date: Apr 2010
Posts: 10,289
Received Thanks: 3,613
[PHP] Load all files in directory (good for loading function files)

Just simply create a file called _require.php in your library where u want to load all php files from and paste this:

Code:
<?php

	$handle = opendir(dirname(__FILE__)); 
	while (false !== ($file = readdir($handle))) { 
		if (preg_match("=^\.{1,2}$=", $file)) { 
			continue; 
		}
		if($file!="_require.php") {
			require ($file);
		}
	}
	closedir($handle); 
	
?>
Now go to your index.php and add after <?php this:
Code:
	include("functions/_require.php");
Now every file in the directory functions/ will be loaded.

Lg
Shawak is offline  
Old 12/12/2013, 00:14   #2
 
elite*gold: 25
Join Date: Sep 2011
Posts: 5,536
Received Thanks: 1,266
Ist das nicht etwas umständlich? Da Zugriffe auf das Dateisystem länger dauern, und wenn gerne mal 100 Dateien geladen werden müssen verlangsamt das, dass ganze Script doch nur unnötig?
IchVerabschiedeMich is offline  
Old 12/12/2013, 18:01   #3



 
Shawak's Avatar
 
elite*gold: 0
The Black Market: 259/0/0
Join Date: Apr 2010
Posts: 10,289
Received Thanks: 3,613
Natürlich ist das langsamer als die Dateien einzeln zu includen.
Shawak is offline  
Old 12/14/2013, 12:00   #4
 
elite*gold: 20
Join Date: Aug 2012
Posts: 714
Received Thanks: 1,168
Oder wenn man mit Klassen arbeitet wie man sollte könnte man auch einfach ein ClassLoader verwenden mit

Gruß,
Chuck
'ChuckNorris is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
dbmon error loading files
08/12/2013 - Dekaron Private Server - 2 Replies
hi i got this problem when i log my files problem with status.cvs and this is a picture::: can some one plz give me a status.cvs that works with a12 thank you all http://imageshack.us/photo/my-images/845/s5k.png/
[BR files]REGIONMGR failed to load
07/19/2012 - SRO Private Server - 1 Replies
I'm working on my own server, and recently I switched from vsro files to Black Rogue files. In VSRO I added Prison, GM_Event and Mohan areas with no problem, however, I can't do it on BR files. For example, I get this error if prison is enabled: REGIONMGR failed to load 32792(x:24, z:128) region Create Game World Map Failed!!! GAMEWORLDID Failed to initialize Map Failed To Load Initial Resource Failed To Init Local Data It's really weird, because Prison's regionID is -32744, not...
[BR files]REGIONMGR failed to load
07/19/2012 - SRO Private Server - 6 Replies
I'm working on my own server, and recently I switched from vsro files to Black Rogue files. In VSRO I added Prison, GM_Event and Mohan areas with no problem, however, I can't do it on BR files. For example, I get this error if prison is enabled: REGIONMGR failed to load 32792(x:24, z:128) region Create Game World Map Failed!!! GAMEWORLDID Failed to initialize Map Failed To Load Initial Resource Failed To Init Local Data It's really weird, because Prison's regionID is -32744, not...
Nach entpacken der Serverfiles : no such or files directory
09/22/2011 - Metin2 Private Server - 2 Replies
Hey com. Also. Ich habe mir die kay2011er files geholt und nachdem ich sie entpackt habe (chmod rechte habe ich Gegeben ) & z.B. g1 oder game99 öffne & da in den game ordner rein will steht da : No such or file direcory (das gleiche bei channel1 & channel2 game ordner) help pls :)))
[Question] Function of some .kom files
04/23/2011 - Grand Chase - 2 Replies
I see in hack injector there's other .kom aside ai.kom i like to know what is the function of: -script.kom -char_script.kom and fan_map.kom thanks in advance ;)



All times are GMT +1. The time now is 11:58.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.