CakePHP
文章平均质量分 78
CDLucifer
...行到水穷处,坐看云起时...
展开
-
【CakePHP1.3】_控制器约定
1.控制器约定(a).控制器名:复数的,驼峰命名法,以Controller结尾例:PeopleController ,LatestArticlesController (b).通过在函数名前加下划线来控制函数的能见度。如果一个控制器的函数名有下划线,那么该函数不能通过Web被访问调用,但是可以在内部调用class NewsController extends AppCont原创 2013-02-19 08:41:02 · 458 阅读 · 0 评论 -
【CakePHP1.3 】Controller的方法
Controller的方法尽管本小节会介绍Cake模型中大多数频繁使用的方法,但也请记住 http://api.cake.org 可以获得完整的API参考。 与你的view进行交互set string $var mixed $value 这个方法是你的view从controller得到数据的主要方法。你可以用它传递任何数据:单一变量值,整个数组,等等。转载 2013-02-28 16:47:51 · 671 阅读 · 0 评论 -
【CakePHP1.3 】Controller的参数
在你的Cake controller里,你可以通过$this->params来访问controller的参数。这个变量用来获取传递到controller的数据,以及提供对当前请求信息的访问。$this->params最常见的用法是用于访问客户端通过POST或者GET操作递交给controller的信息。$this->data用来处理来自HTML helper的POST表单数据。 //转载 2013-02-28 16:55:48 · 555 阅读 · 0 评论 -
【CakePHP】find()
find方法.find($type, $params)其中$type可以是'all', 'first', 'count', 'neighbors','list','threaded', 默认用first。$params是一个下面所列出的选项作为key的数组:array( 'conditions' => array('Model.field' => $thisValue), //条转载 2013-02-26 09:37:11 · 853 阅读 · 0 评论 -
【CakePHP】几个CakePHP知识点
如何禁止布局?如果需要禁止布局功能的动作或控制器比较多的话,那么可以在控制器中统一设置autoLayout为false,如果只是个别的模板的话,那么最好是直接在模板文件里设定$this->autoLayout = false,而不要在控制器里设定,毕竟使用布局与否是一个视图逻辑。视图助手的一些注意事项?在模板里使用图片的时候,最好是使用助手的方式,如:echo $html-转载 2013-02-21 14:25:16 · 1447 阅读 · 0 评论 -
【CakePHP】21条经验总结
这篇文章可以说是CakePHP教程中最经典的了。虽然不是完整的手把手系列, 但作者将自己使用CakePHP的经验总结了21条,这些尤其是对新手十分有用。 翻译时故意保留了一些CakePHP中特有的词语没有翻译, 如controller、model等。相信学过CakePHP的人应该马上就能理解它们的意思吧。 另外,CakePHP的wiki已经失效,取而代之的是一个名为bakery的网转载 2013-02-21 09:38:35 · 607 阅读 · 0 评论 -
【CakePHP】执行详细流程
加载基本文件 cake/basics.php 里面定义了常用的方法以及时间常量 $TIME_START = getMicrotime(); 记录开始执行时间 cake/config/paths.php 里面定义一些基本路径 cake/lib/object.php cake转载 2013-02-21 09:50:08 · 1165 阅读 · 0 评论 -
【CakePHP1.3】_ACL和auth
准备前工作:最好是能配置好bake,使bake命名有效,虽然这个不是必须的,不过有这个命令行工具以后我们会方便很多在你的数据库中导入下面的sql语句CREATE TABLE users ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL UNIQUE,转载 2013-02-20 11:16:12 · 1225 阅读 · 1 评论 -
【CakePHP1.3】_Optional Configuration
There are three other items that can be configured. Most developers complete these laundry-list items, but they’re not required for this tutorial. One is defining a custom string (or “salt”) for use i原创 2013-02-18 16:37:36 · 417 阅读 · 0 评论 -
【CakePHP1.3】_CakePHP注意事项
关于数据库和 CakePHP 的一些注意事项: 表必须具有名为 id 的主键。 如果表中包含 created 或 modified 列,CakePHP 就会在适当的时候自动填充字段。 表名应该为复数(users、products、eggs、sodas、winners、losers)。其相应的模型将具有单数的名称(user、product、egg、soda、winner、loser)。原创 2013-02-18 11:21:36 · 399 阅读 · 0 评论 -
【CakePHP1.3】_视图约定及命名小结
视图模板文件名称由控制器函数名决定,按下划线的格式。例:控制器PeopleController中的getReady()将会在/app/View/People/get_ready.ctp.检索视图模板文件命名小结例:• Database table: “people”• Model class: “Person”, found at /app/Model/Person.php原创 2013-02-19 09:56:23 · 582 阅读 · 0 评论 -
【CakePHP1.3】_CakePHP Conventions
Controller ConventionsController classnames are plural, CamelCased, and end in Controller. PeopleController and LatestArticlesController are both examples of conventional controller names.You can原创 2013-02-18 15:06:49 · 529 阅读 · 0 评论 -
【CakePHP1.3】_模型和数据库的一些约定
模型和数据库的一些约定1.模型命名:单数,驼峰命名法例:Person, BigPerson, ReallyBigPerson2.表名命名:(a).数据库表名是由模型名决定的,复数的、下划线的例:people, big_people, really_big_people(b).字段名由多个单词组成时,单词间应加下划线例:first_name(c).外键应当采用原创 2013-02-19 09:15:45 · 397 阅读 · 0 评论 -
【CakePHP1.3】_文件名、类名约定
文件名、类名约定通常,文件名匹配类名,类名采用驼峰命名法。例:假如有一个类MyNiftyClass,那么它一定在 MyNiftyClass.php文件中The Controller class KissesAndHugsController would be found in a file named KissesAnd-HugsController.php• The Comp原创 2013-02-19 09:08:57 · 406 阅读 · 0 评论 -
【CakePHP】Controller
在CakePHP里,一个controller用于管理应用程序某一方面的逻辑.大多数情况下,controller被用于管理独立model的逻辑,controller的名字总是复数形式.每个controller可以包含任意数量的方法(action). 一个action,是controller里的一个独立的方法.这个controller.action对象的方法将被Dispatcher类分转载 2013-02-21 16:15:20 · 673 阅读 · 0 评论