Let's say two ways:
1) Define a string variable that holds the list of files to be loaded. Then foreach loads.
Copy CodeThe code is as follows:
$a = '/a.class.php;/util/b.class.php;/util/c.class.php ';
$b = '/d.php;/e.class.php;/f.class.php;/g.class.php ';
Loading basic System files
$kernel _require_files = explode ('; ', $a);//sys_require_lib_file_list);
foreach ($kernel _require_files as $f) {
Require_once (Sys_lib_path. ' /system '. $f);
}
Loading basic System files
$kernel _require_files = explode ('; ', $b);//sys_base_file_list);
foreach ($kernel _require_files as $f) {
Require_once (Kernel_path. $f);
}
2) Load all the files to be loaded in an include file, the current page directly include the include file.
include.php File Contents
Copy CodeThe code is as follows:
Require_once (' func.php ');
Require_once (' LangManager.class.php ');
Require_once (' _kernelautoloader.class.php ');
Require_once (' ApplicationSettingManager.class.php ');
Require_once (' lib/system/activator.class.php ');
Require_once (' lib/system/util/cxml.class.php ');
Require_once (' lib/system/util/cweb.class.php ');
I personally think that the second method is more efficient, because there is no foreach these redundant operations ~ Everything to argument, can't imagine, so, I verified a bit. Here's how long it takes to load randomly 10 times in two ways:
Foreach
0.017754077911377
0.017686128616333
0.017347097396851
0.018272161483765
0.018272161483765
0.018401145935059
0.018187046051025
0.020787000656128
0.018001079559326
0.017963171005249
Include_once (' include.php ');
0.025792121887207
0.024733066558838
0.025041103363037
0.024915933609009
0.024657011032104
0.024134159088135
0.025845050811768
0.024954080581665
0.024757146835327
0.02684497833252
Also, try again and load all the files directly on the current page
0.022285938262939
0.024394035339355
0.023194074630737
0.023229122161865
0.024644136428833
0.023538112640381
0.024240016937256
0.025094032287598
0.023231029510498
0.02339506149292
The results surprised me! The first seemingly the slowest method, the least time-consuming, and loading multiple files directly on the current page is time-consuming and many AH ~
Reason? Unknown ah, want to give an answer to the eye, first, regardless of so many "x plan" core loading part of the first method of ~
http://www.bkjia.com/PHPjc/322301.html www.bkjia.com true http://www.bkjia.com/PHPjc/322301.html techarticle Let's say two ways: 1) Define a string variable that holds the list of files to be loaded. Then foreach loads. Copy the code code as follows: $a = '/a.class.php;/util/b.cla ...