autoload.php

<?php
function framework_autoload($className){
$className=str_replace('\\','/',$className);
include_once($className.'.class'.'.php');
}
spl_autoload_register('framework_autoload');

init.php

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/comm.php"); // 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
define('APP_DEBUG',true);
APP_DEBUG?error_reporting(E_ALL):error_reporting(0); // 定义应用目录
define('APP_PATH',$_SERVER['DOCUMENT_ROOT'] . "/new_framework/"); //定义按照类名自动加载的include起始路径
$autoLoadIncludePath=array(APP_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR .implode(PATH_SEPARATOR,$autoLoadIncludePath)); //php自动加载
require_once(APP_PATH."BLL/autoload.php"); //mvc 处理
$c=$_REQUEST['c'];
$controller='Controller\\'.$c.'Controller';
$action=$_REQUEST['a'];
if(!class_exists($controller)){
$res['code']=1000;
$res['msg']=$c.'控制器不存在!';
}else if(!method_exists($controller,$action)){
$res['code']=1001;
$res['msg']=$action.'方法不存在!';
}else{
$controllerObj=new $controller();
$res=$controllerObj->$action();
}
echo json_encode($res);

最新文章

  1. springMVC接收参数的几种方式
  2. jquery 巧用json传参
  3. java 中如何声明线程安全的集合 set, map 和list
  4. linker command failed with exit code 1 (use -v to see invocation)解决办法
  5. LoadRunner11录制APP脚本(2)
  6. Zabbix自带模板监控MySQL
  7. laravel框架总结(五) -- 服务提供者(提及契约Contracts)
  8. SIP中OPTIONS方法的用法及示例
  9. ibatis.net demo
  10. [Linux/Ubuntu] vi/vim 使用方法讲解(转载)
  11. 用Eclipse和GDB构建ARM交叉编译和在线调试环境
  12. JS(移动端)自己封装移动端一些常用方法
  13. 【JAVASCRIPT】event对象
  14. 用Python做大批量请求发送
  15. python __call__或者说func()()的理解
  16. 月赛 &amp;&amp; SX_ACM 惨痛教训
  17. centos7.2 源码编译安装php7.2.4 apache2.4.37 https证书安装
  18. jQuery 插件使用记录
  19. Bash:常用命令工具-tr命令
  20. linux/unix 段错误捕获_转

热门文章

  1. numpy安装失败-小失误
  2. C/C++关键字
  3. ubuntu操作系统的目录结构
  4. Maven服务器的使用之Maven桌面项目和Maven Web项目的创建
  5. google浏览器 打印A4 最大宽度和高度px
  6. WPF动态折线图
  7. jsp 多条件组合查询
  8. DOM学习之图片库切换效果
  9. nyoj169-素数
  10. 15.id生成的两种方式