4 Star 7 Fork 3

亓斌 / LoadPHP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

#LoadPHP 一个简单的基于smarty的PHP框架,很久以前写的,都快忘了它了,现在拿出来了哈。

/**
+-------------------------------------------------------

  • 更新日志
    +------------------------------------------------------- */


V1.4:
1、将数据库连接所在的方法设置为静态方法。
2、通过新增的init($table)函数实例化数据库操作类,并设置要操作的表名。
3、eg: $user = init("user");$user->insert(array(NULL,"loadphp"));
4、更改首次运行判断文件的存在位置,修复多个子项目中,其他子项目不能自动创建目录及文件等bug
5、将框架自带功能类和核心类分离(core目录和class目录)。
6、新增commons/function和commons/class目录,优化用户自定义扩展类、函数功能。
7、用户自定义函数在使用时无需包含,系统会自动包含。

V1.5:
1、主要优化数据库的操作方式
2、支持级联操作
实例代码:
$user = init("user");
$user->insert(array(NULL,"loadphp")); // 插入操作
$user->where(array("id"=>1))->update("name"=>"loadphp"); //更新操作
$user->where(array("id>"=>2))->del(); //删除操作
$user->where(array("id"=>1,"name like"=>"%load%"),"or")->order("id DESC")->limit(2)->findAll(); //查询多条记录
$user->where(array("id"=>1,"name like"=>"%load%"),"or")->order("id DESC")->limit("1,2")->findAll(array("name")); //查询多条记录
$user->where(array("id"=>1,"name like"=>"%load%"),"or")->order("id DESC")->find(); //查询一条记录
3、优化分页,在默认执行文件名、控制器、方法的情况下也可以添加分页

V1.5.1:
1、主要优化用户自定义函数加载方式。
2、修复where、order、limit等语句参数为空时SQL语句不能正常组合的BUG。
现在可以这么用:
$user=init("user");$user->where()->order()->limit()->findAll(); //查询多条记录
3、优化init()函数,当DB对象存在时不会再次创建新的对象,只做设置表名操作。
4、优化数据库操作类,解决用户自定义model不能完全继承父类的bug。
5、优化数据库取得总条数的方式,用户不必查询总条数后得到,
例如:
以前:$user = init("user");$user->query("select * from user");echo $user->getRows(); //输出10
现在: $user = init("user"); echo $user->getRows(); //输出10
6、优化DB::query()方法,更好的支持select insert update delete等sql语句

V1.6:
1、优化用户配置方式,将用户配置信息从主入口文件分离,成立单独文件(loadConfig.php)
2、新增支持URL伪静态功能。
打开loadphp/loadConfig.php文件,修改 IS_STATIC和STATIC_FOLLOWING的值决定是否启用伪静态(默认开启)和伪静态扩展名

例程:
例如用户定义:define("IS_STATIC",true);define("STATIC_FOLLOWING",".html");
则以下URL方式可以接受:
http://servername/index.php/index.html 等同于 http://servername/index.php/index
http://servername/index.php/index/action.html 等同于 http://servername/index.php/index/action
http://servername/index.php/index/action/id/1.html 等同于 http://servername/index.php/index/action/id/1

以上例程中的扩展名用户可以自定义,例如:
若:define("STATIC_FOLLOWING",".shtml");
则以下URL方式可以接受:
http://servername/index.php/index.shtml 等同于 http://servername/index.php/index
http://servername/index.php/index/action.shtml 等同于 http://servername/index.php/index/action
http://servername/index.php/index/action/id/1.shtml 等同于 http://servername/index.php/index/action/id/1
3、访问未定义控制器或未定义动作时,会返回首页
4、允许用户自定义模板变量界限符,在loadConfig.php文件中
5、允许用户自定义模板文件类型
6、优化模板文件存放方案,模板文件实则存放在view/模板套目录(默认为default)/控制器(需手工创建)下
例如:Index控制器下面的User方法要调用的模板文件是view/default/Index/User.html
7、允许用户修改模板套目录,在loadConfig.php文件中修改
8、修改display使用方式,如果添加模板参数,用户不需要添加扩展名
例如:在非Index方法中调用index.html文件(因为在Index方法中调用直接用$this->display()即可),用法是:$this->display("index");
9、从LoadPHP1.6开始提供两个版本的框架:core核心板和full完整版。
核心板不提供smarty模板引擎,需用户自己将smarty的所有文件复制到loadphp/lib目录下

V1.7
1、新增访问当前控制器的方式,常量CURURL,在模板中使用。
2、优化目录创建方式。
3、修复缓存清理机制,清理当前控制器下的缓存:$this->clearCache();清理全部缓存$this->clearAllCache();
4、更改用户创建项目方式,所有入口文件必须与loadphp目录同级。
例如:以前的版本可以这样:在loadphp目录同级的目录创建admin目录,在admin目录下创建index.php
现在强制这样做:在loadphp目录同级的目录创建admin目录,在loadphp目录同级的目录创建admin.php,并define("APP_PATH",'./admin');
5、通过第四点修改,commons目录和public目录都会创建在admin目录里,为admin项目的公用文件目录。
6、新增pub目录与loadphp目录同级,为多个项目公用文件目录。访问方式:PUB_PATH(相对于本文件的目录)、$pub_path(相对根目录)、(模板中使用)。
7、修改系统D方法名为load(系统自动调用)。
8、优化目录自动创建。

v1.8
1、优化处理缓存URL条件
2、重写安全检测类,使用方式:$check = new CheckInput(0); // 0为检测,安全返回true。1为屏蔽,返回屏蔽后的字符串
3、提供切换 检测/屏蔽 方式,例如上面为检测用的,现在不用在重新创建对象,只需调用$ch->changeMeta()方法即可切换至屏蔽功能

v1.9
1、新增$this->display("模板名@模板目录");方式访问非本控制器下的模板,例如$this->display("index@User");表示使用User控制器下的index文件
2、修改提示消息为$this->display("notice",1/2,URL); // 1为成功 2为失败
3、优化模板文件,解决模板文件不能正常包含的问题
4、新增tplpath模板变量,表示当前模板套名,用来访问不同控制器下的模板文件
5、所有模板文件必须的Default(可自定义)目录下的一个目录中,例如header共用文件,可放在Default/public/目录下,使用时/public/header.html")>
6、修复DB::getRows()在有条件时不能正确得到结果的BUG,如果要查询id>5的结果数可以这样:
$db = init("user");$db->where(array("id > "=>5))->getRows();

v2.0
1、框架基类Base.class.php改名为BaseAction.class.php
2、模型基类DB.class.php改名为DBModel.class.php
3、规范控制器命名规则,例如:Index控制器必须命名为IndexAction,同时继承BaseAction
4、规范模型命名规则,例如:User模型必须命名为UserModel,同时继承DBModel
5、优化用户扩展model,使用自定义model可调用新增函数initM(),iniM()函数和init()函数的使用方式一样,参数为要操作的表名
6、修复提示页面有输出问题。
7、删除Mysql.class.php类,没有必要用mysql系列函数了。
8、说明:通过本次更新,加强了框架的MVC开发能力。
9、下个版本或将考虑加入数据表前缀设置,精简smarty模板

v2.1
1、优化伪静态功能,用户可以自定义分隔符(默认为‘-’),例如:index.php/index-test-name-load.html实则访问index.php/index/test/name/load
2、优化PDO数据库操作类
3、优化DBModel::query()方法
4、将init()函数(实例化系统模型对象)修改为D()函数
5、将initM()函数(实例化扩展模型)修改为M()函数
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2014 亓斌 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

一个简单的,可以用于MVC学习的PHP框架 展开 收起
PHP
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/qibin/LoadPHP.git
git@gitee.com:qibin/LoadPHP.git
qibin
LoadPHP
LoadPHP
master

搜索帮助