自制一个小小的网站,其中一个功能总是有有关问题,求各位解答

WBOY
Release: 2016-06-13 11:10:10
Original
890 people have browsed it

自制一个小小的网站,其中一个功能总是有问题,求各位解答?
one.php:(开始运行的入口)

<br /><?php<br />	/**<br />	 * index.php MyLocalShop 入口<br />	 * <br />	 * @copyright	(C)2013-2014 MyLocalShop<br />	 * @license		http://www.baidu.com/<br />	 * @lastmodify	2013-01-07<br />	 */<br />	<br /><br />	/**<br />	 * 网站根目录路径<br />	 * @var string<br />	 */<br />	define('LOCALSHOP_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);<br />	//echo LOCALSHOP_PATH;<br />	<br />	require_once LOCALSHOP_PATH.'/base.php';<br />	$mls = new MLS();<br />	$mls->Load('front/includes/', 'dindex.phdp');  // 这是错误的,但为什么这里同样正确显示?<br />        $mls->Load('front/includes/', 'index.php');   // 这个才是真正文件名<br />?><br />
Copy after login


dir_list.php:(显示目录树结构用于在base.php中判断是否有该目录或文件)
<br /><?php<br />/**<br /> * 显示整个网站的目录树结构<br /> * @author Administrator<br /> *<br /> */<br />function dir_list() {<br />		return array(<br />			'admin' => array(<br />						'css',<br />						'images',<br />						'includes' => array(<br />										'libs'<br />						),<br />						'js'<br />			),<br />			'common' => array(<br />						'config' => array(<br />										'admin' => array(<br />													'config.php'<br />										),<br />										'front' => array(<br />													'config.php'<br />										),<br />										'config.php',<br />										'dir_list.php'<br />						),<br />						'includes' => array(<br />										'libs'<br />						),<br />						'js',<br />						'languages' => array(<br />										'en_US' => array(<br />													'admin' => array(<br />																'common.php'<br />													),<br />													'front' => array(<br />																'common.php'<br />													)<br />										),<br />										'zh_CN' => array(<br />													'admin' => array(<br />																'common.php'<br />													),<br />													'front' => array(<br />																'common.php'<br />													)<br />										)<br />						),<br />						'templates' => array(<br />										'Templates.php'<br />						)<br />			),<br />			'front' => array(<br />						'css',<br />						'images',<br />						'includes' => array(<br />										'libs'<br />						),<br />						'js'<br />			),<br />			//'base.php',<br />			//'index.php'<br />		);<br />}<br />?><br />
Copy after login


base.php:(用于检查目录及文件名是否存在,存在则转向所指页面)

<br><?php <br />/**<br> * MyLocalShop 框架入口<br> * @author Administrator<br> *<br> */<br>	require_once LOCALSHOP_PATH.'/common/config/dir_list.php';<br>	<br>	class MLS {<br>		/**<br>		 * 私有函数。判断是否存在该目录或文件,有则返回true,无则返回false<br>		 * @param string $target	目录或文件<br>		 * @return 若判断为文件类型则返回"beFile",若判断为目录类型则返回"beDir";若既不是文件也不是目录则返回 false。<br>		 */<br>		private function hasDirectoryOrFile($target) {<br>			$dirs = MLS::load_all_directory();<br>			<br>			foreach ($dirs as $key => $value) {<br>			if (in_array($target, $value)) {<br>				$suffix = substr($target, -1, 4);<br>				if ($suffix === '.php')<br>				/*if (strrchr('.php', $target) || strrchr('.html', $target) || strrchr('.htm', $target) || strrchr('.xhtm', $target) ||<br>						strrchr('.xhtml', $target) || strrchr('.tpl', $target) || strrchr('.xml', $target) || strrchr('.xls', $target) ||<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template