Homemade a small website, one of the features always have a problem, ask you to answer?
One.php: (entry to start running)
/**
* index.php mylocalshop Entrance
* @copyright (C) 2013-2014 Mylocalshop
* @licensehttp://www.baidu.com/
* @lastmodify2013-01-07
*/
/**
* Site root directory path
* @var String
*/
Define (' Localshop_path ', DirName (__file__). Directory_separator);
Echo Localshop_path;
Require_once Localshop_path. ' /base.php ';
$mls = new MLS ();
$mls->load (' front/includes/', ' DINDEX.PHDP '); This is wrong, but why is it also shown correctly here?
$mls->load (' front/includes/', ' index.php '); This is the real file name.
?>
Dir_list.php: (Displays the directory tree structure used to determine whether the directory or file is in base.php)
!--? php
/**
* Displays the entire site's directory tree structure
* @author Administrator
*
*/
function Dir_list () {
return Array (
' admin ' = = = Array (
' CSS ',
' images ',
' includes ' = = Array (
') Libs '
),
' JS '
),
' common ' = = Array (
' config ' = = Array (
' admin ' = = = Array (
' config.php ')
),
' front ' = = Array (
' config.php '
),
' config.php ',
' dir_list.php '
),
' includes ' = Array (
' libs '
),
' JS ',
' languages ' = = Array (
' en_us ' = = Array (
' admin ' = = = Array (
') Common.php '
),
' front ' = = Array (
' common.php '
)
),
' zh_cn ' = = Array (
' admin ' = = Array (
' common.php '
),
' front ' = = Array (
' common.php '
)
)
),
' templates ' = = Array (
' templates.php '
)
),
' front ' = = Array (
' CSS ',
' images ',
' includes ' = = Array (
' libs '
) ,
' JS '
),
//' base.php ',
//' index.php '
);
}
?
base.php: (Used to check if the directory and file name exist, and then turn to the referring page)
/**
* Mylocalshop Frame Entrance
* @author Administrator
*
*/
Require_once Localshop_path. ' /common/config/dir_list.php ';
Class MLS {
/**
* Private Function. Determines whether the directory or file exists, returns True if none, and returns false
* @param string $target directory or file
* @return If the file type is determined to return "Befile", if the directory type is determined to return "Bedir", if neither the file nor the directory returns false.
*/
Private Function Hasdirectoryorfile ($target) {
$dirs = Mls::load_all_directory ();
foreach ($dirs as $key = = $value) {
if (In_array ($target, $value)) {
$suffix = substr ($target,-1, 4);
if ($suffix = = = '. php ')
/*if (STRRCHR ('. php ', $target) | | STRRCHR ('. html ', $target) | | strrchr ('. htm ', $target) | | strrchr ('. xhtm ', $target) | |