自製一個小小的網站,其中一個功能總是有有關問題,求各位解答

來源:互聯網
上載者:User
自製一個小小的網站,其中一個功能總是有問題,求各位解答?
one.php:(開始啟動並執行入口)

/**
* index.php MyLocalShop 入口
*
* @copyright(C)2013-2014 MyLocalShop
* @licensehttp://www.baidu.com/
* @lastmodify2013-01-07
*/


/**
* 網站根目錄路徑
* @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'); // 這是錯誤的,但為什麼這裡同樣正確顯示?
$mls->Load('front/includes/', 'index.php'); // 這個才是真本文件名
?>


dir_list.php:(顯示分類樹結構用於在base.php中判斷是否有該目錄或檔案)

/**
* 顯示整個網站的分類樹結構
* @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:(用於檢查目錄及檔案名稱是否存在,存在則轉向所指頁面)

/**
* MyLocalShop 架構入口
* @author Administrator
*
*/
require_once LOCALSHOP_PATH.'/common/config/dir_list.php';

class MLS {
/**
* 私人函數。判斷是否存在該目錄或檔案,有則返回true,無則返回false
* @param string $target目錄或檔案
* @return 若判斷為檔案類型則返回"beFile",若判斷為目錄類型則返回"beDir";若既不是檔案也不是目錄則返回 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) ||
strrchr('.xhtml', $target) || strrchr('.tpl', $target) || strrchr('.xml', $target) || strrchr('.xls', $target) ||
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.