Home >Backend Development >PHP Tutorial >刚刚看了几个推荐框架的帖子,蛮多推荐codeigniter的,请恕小弟我直言,那框架实在不敢恭维啊个人意见,仅供参考
刚刚看了几个推荐框架的帖子,蛮多推荐codeigniter的,请恕我直言,那框架实在不敢恭维啊~个人意见,仅供参考。
首先我是用过codeigniter的,刚开始学框架的时候用过一阵子,然后后来公司用thinkphp,就没再用了,用了2个之后,就会有一些对比性。首先这2个框架文件夹容量都比较大,称不上轻量级之类的,我都不怎么看好。
今天单说codeigniter框架
举个官网控制器调用模板的例子
<?php<br />class Blog extends CI_Controller {<br /><br /> function index()<br /> {<br /> $data['title'] = "My Real Title";<br /> $data['heading'] = "My Real Heading";<br /> <br /> $this->load->view('blogview', $data);<br /> }<br />}<br />?>
<html><br /><head><br /><title><?php echo $title;?></title><br /></head><br /><body><br /> <h1><?php echo $heading;?></h1><br /></body><br /></html>
<?php <br />//template.php<br>/**<br> * Copyright (c) 2003 Brian E. Lozier ([email protected])<br> *<br> * Permission is hereby granted, free of charge, to any person obtaining a copy<br> * of this software and associated documentation files (the "Software"), to<br> * deal in the Software without restriction, including without limitation the<br> * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or<br> * sell copies of the Software, and to permit persons to whom the Software is<br> * furnished to do so, subject to the following conditions:<br> *<br> * The above copyright notice and this permission notice shall be included in<br> * all copies or substantial portions of the Software.<br> *<br> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br> * IN THE SOFTWARE.<br> */<br><br>class Template {<br> var $vars; /// Holds all the template variables<br> var $path; /// Path to the templates<br><br> /**<br> * Constructor<br> *<br> * @param string $path the path to the templates<br> *<br> * @return void<br> */<div class="clear"> </div>