这个是根据面试题做出来的,最精简的框架,用一下午时间做出来。
为了功能实现,任何防护和过滤都没有。
作者:风来了.呆狐狸
<?php // 根目录 define('ROOT', __DIR__); $c=trim($_REQUEST['c']); $a=trim($_REQUEST['a']); //配置加载 include ROOT.'/config/config.php'; header("Content-type:text/html;charset=".CHARSET); //控制器加载 if (empty($c)) $c = 'index'; if (empty($a)) $a = 'init'; //是否已安装 if (!file_exists(ROOT.'/install.lock')) { $c = 'install'; $a = 'init'; } $file = ROOT.'/app/'.$c.'.php'; if (file_exists($file)) { include ROOT.'/class/DB.php'; include ROOT.'/class/fun.php'; include $file; if(class_exists($c)){ $controller= new $c; if (method_exists($controller, $a)) { call_user_func([$controller, $a]); } else { exit('该动作不存在'); } }else{ exit('控制器不存在.'); } } else { exit('控制器不存在'); }其他请看附件地址
http://download.csdn.net/detail/wljk506/8190339
面试题:
1. Introduction The following test-case1 is given to any future developer. The aim is to get to know you and the way you are working. We also want to test your basic PHP / MySQL skills. You have to use PHP / MySQL and you may use JavaScript. You should not use any predefined code downloaded from the internet. You are free on how you want to organize the files, database structure and code. You should try to develop in a way that allows for further increasing the functionality of the test-case 1 with little adjustments. 2. Task A tiny version of an address-book should be developed. There should be some sort of list showing all the entries already made, a form to create new entries and edit existing ones and the possibility to export the list into a XML-file. Each entry should consist of the fields (name, first name, street, zip-code, and city) where the city should be a drop down, with cities defined in a table in the database. The design should be user-friendly but 3. Procedure You have to develop this little program on your own system, then send the code files, a file containing all the queries needed to create the database, a file with the queries to enter test-data, and a file containing the hours you have worked and on what you have been working, to us. 4. Files to hand in a) Code files (may be several) b) File containing all the queries to setup the database c) File containing the queries to enter test-data d) The filled in journal (test-case_1.docx)