mvc封装
文章平均质量分 64
mounttp
让我们一起套马杆呀
展开
-
mvc框架封装( 二)类自动加载
1.首先,把自动加载类放入imooc.php文件中,新建一个 静态方法起名叫loadstatic public function load(){ } 2.然后在core目录下创建一个路由文件route.php <?php namespace core; class route { } 3.加载这个路由类,我们需要三个步骤 首先在入口文件in原创 2016-12-24 16:31:58 · 681 阅读 · 1 评论 -
学习封装mvc框架(十一)twig模板引擎
首先我们要在composer.json中加入 "twig/twig":"*" 然后进入根目录命令行:composer update 进行下载 然后在我们的imooc核心类中进行更改 public function display($file) { $file = APP.'/views/'.$file; // p($this原创 2016-12-29 14:35:59 · 768 阅读 · 0 评论 -
学习数据库封装(十)medoo数据类
首先我们用compoer来安装一个清凉数据库框架medoo 先把medoo的连接:http://medoo.lvtao.net/ 先在composer.json中加入 "catfan/medoo":"*"然后根目录下执行cmd命令行:composer update 然后将\app\core\config目录下的database数据库下放入: 'database_type'原创 2016-12-28 20:18:10 · 575 阅读 · 0 评论 -
从gitHub远程库上克隆你的分支branch
首先:在你的磁盘上建立一个空文件夹git12 1.git clone https://github.com/xxx/xxx.git 2.xxxx@Lenovo-PC MINGW64 /e/git12 $ ls mvc/ 3.xxx@Lenovo-PC MINGW64 /e/git12 $ cd mvc/ 4.xxx@Lenovo-PC MINGW64 /e/git12/mvc (mast原创 2016-12-27 15:33:04 · 3451 阅读 · 0 评论 -
git添加branch分支
通过git命令: git init git status git add * git status git commit -m "fu" git remote add origin https://github.com/xxx.git git push origin master:fu先在你可以上你的gitHub查看你的branch fu已经存在了原创 2016-12-27 15:25:50 · 1320 阅读 · 0 评论 -
学习封装mvc(八)日志类
日志类呢可能存在文件中,也可能存在数据库中,也可能存在缓存中,下面讲下日志类是怎么存在文件中的 首先在\core\lib下建立日志类log.php,代码如下 <?php namespace core\lib; use core\lib\conf; class log { /** * 1.确定日志存储方式 * 2.写日志 */ static $原创 2016-12-27 13:21:49 · 251 阅读 · 0 评论 -
学习封装mvc框架(七)配置加载类
为了提高我们框架的健壮性,下面我们来写一个配置类来加载我们的配置 首先在core\lib下建立conf.php <?php namespace core\lib; class conf { static public $conf = array(); //建一个配置属性来存放配置 static public f原创 2016-12-26 16:02:49 · 293 阅读 · 0 评论 -
学习封装mvc(六)视图层的显示
首先在ctrl控制器中 <?php namespace app\ctrl; class indexCtrl extends \core\imooc //继承基类 { public function index() { header("content-type:tex原创 2016-12-25 21:21:57 · 732 阅读 · 0 评论 -
学习封装mvc系列(五)控制器中连接数据库
首先在lib文件夹下建立modle.php <?php namespace core\lib; class model extends \PDO { public function __construct() { $dsn='mysql:host=127.0.0.1;dbname=laravel';原创 2016-12-25 20:25:35 · 1080 阅读 · 0 评论 -
学习mvc框架封装(四)加载控制器
首先app目录下建立一个ctrl文件夹下indexCtrl.php <?php namespace app\ctrl; class indexCtrl { public function index() { p('this is a index'); //建立index方法 } } ?>加载控制器原创 2016-12-25 18:54:23 · 271 阅读 · 0 评论 -
mvc封装(三)路由类
首先调用路由类 $route = new \core\lib\route(); // 引入路由类来触发spl_autoload_register 使访问的地址为xxx.com.index/index p($route); 接下来在路由类route.php中,直接上代码 <?php namespace core\lib; use core\lib\conf;原创 2016-12-25 17:08:22 · 435 阅读 · 0 评论 -
阿里云centos6.5安装php环境
你还在为Linux搭载环境费劲吗?请看一步到位 wget -c http://lamp.phpstudy.NET/phpstudy.bin chmod +x phpstudy.bin #权限设置 ./phpstudy.bin #运行安装原创 2016-12-29 18:59:37 · 478 阅读 · 0 评论