of controller:
class yourController extends AppController { var $uses = array('Post','User');}
In this way, the controller can access Post and User model.
Create a model without using a database table
I need to create a model that does not use any table. For example, I want to use the $ validate array to verify the input data and ensure that the model logic is correct. However, when the table corresponding to the model is created does not exist, CakePHP
Cakephp Manual Series 1: how to configure cakephp it has been more than a year since the cakephp development project was used. recall the scenario where the configuration was copied by video at the beginning, I feel that the progress is indeed not small, so I want to summarize the various problems encountered in the learning and development process as a manual fo
First look at CakePHP's implementation process (from Baidu Encyclopedia borrowed Pictures):
1: First your server must support rewrite, if it is not supported rewrite virtual host, cakephp will not work properly.
2: After all requests are directed to the cakephp framework, the route,cakephp comes into the framework with a set of default distribution rules (for exa
A simple blog system instance based on CakePHP and a cakephp blog instance. A simple blog system instance based on CakePHP. a cakephp blog instance is a simple blog system based on CakePHP. Share it with you for your reference. The specific implementation method is based on
Simple Blog system instance based on CakePHP and cakephp blog instance
This example describes a simple blog System Based on CakePHP. Share it with you for your reference. The specific implementation method is as follows:
PostsController. php file:
Post. php file:
Routes. php file:
The blog. SQL file is as follows:
-- MySQL dump 10.13 Distrib 5.5.19, for Win64
always stare at the manual. Wiki and API are also invaluable. The development guide in wiki is very useful, and the API documentation looks difficult at the beginning, but you will soon find that the information here is very important for you to create a CakePHP website.
Use bake. php
Bake is a command line PHP script that can automatically generate model, contr
For more information about cakephp, see the cakephp code. Why does the AuthComponent: user (id) fail to get the PHPcodefunctionlogin () {if (empty ($ this- gt; request- gt; data [User] [username]) orempty ($ this- gt; request- g understand cakephp to see why the cakephp code is :: user ('id') cannot get the value
P
to become the architect of children's shoes, read cakephp core code of learning value, personally think very high. The basic modules and functions of the common MVC framework are understood initially by using the API for cakephp encapsulation. In the advanced process, read the core code to understand the design principles. Finally, by optimizing the code to achi
viewing the source code. Of course, do not forget to change the debugging level back to 0 when releasing the website.
?
Obtain rich development documentsDon't always stare at the manual. Wiki and API are also invaluable. The development guide in wiki is very useful, and the API documentation looks difficult at the beginning, but you will soon find that the information here is very important for you to crea
, and the API documentation looks difficult at the beginning, but you will soon find that the information here is very important for you to create a CakePHP website. '
Use bake. php
Bake is a command line PHP script that can automatically generate model, controller, and view based on the database. At the initial stage of development, I strongly recommend using scaffolding to run your prototype program. But
this way, the page layout can be maintained, and debugging information can be viewed by viewing the source code. Of course, do not forget to change the debugging level back to 0 when releasing the website.Obtain rich development documents
Don't always stare at the manual. Bakera and APIs are also invaluable. The development guide in wiki is very useful, and the API documentation looks difficult at the beginning, but you will soon find that the inform
code written very good, interface design is very beautiful, router performance is very poor!
So many frames ~ one is useless. thinkphp experience, Yii also experienced, specifically how, I do not know
I personally think that Laravel to third-party package is too much to rely on (especially symfony), the feeling is to symfony two times development
The Laravel API documentation is too streamlined. Streamlined so that you do not see the source
beginning of the controller:
Class Yourcontroller extends AppController {var $uses = array (' Post ', ' User ');}
This allows the controller to access the post and user model.
To create a model that does not use a database table
I need to create a model that doesn't use any tables. For example, I want to validate the input data with the $validate array, and keep the model logic correct. However, the corresponding table when creating the model does not exist,
stare at the manual. Wikis and APIs are priceless. The development guide in the wiki is useful, and the API documentation looks difficult at first, but you'll soon find that the information here is important for you to create a cakephp site.
?
Using bake.phpBake is a command-line PHP script that automatically generates model, controller, and view based on the database. In the early stages of development, I
-motivation to become the architect of children's shoes, read cakephp core code of learning value, personally think very high. The basic modules and functions of the common MVC framework are understood initially by using the API for cakephp encapsulation. In the advanced process, read the core code to understand the design principles. Finally, by optimizing the c
:#cakeSqlLog {display:none;}This allows you to maintain the layout of the page and see the debug information by looking at the source code. Of course, when you finally publish the site, don't forget to change the debug level back to 0.Get Rich development documentationDon't always stare at the manual. Wikis and APIs are priceless. The development guide in the wiki is useful, and the API documentation looks difficult at first, but you'll soon find that
This problem toss a little time, so learn from the first flowchart1. Installing Pear1) on the command line, go to the PHP installation directory and run:Go-pear.bat(There may be error conditions)2) Download Go-phar.bat to PHP installation directory and run:PHP Go-pear.phar3) Double-click on the newly generated Pear_env.reg to import the registry4) At this time pear should be installed successfully, update to the latest version:Pear Upgrade(This step is very important, PHPUnit seems to use the Pe
Originally wanted to separate the front and back, but read cakephp's instructions, only to find that cakephp does not support the path/to path at all.The admin separation method given by CakePHP official website: http://book.cakephp.org/2.0/en/development/routing.html#prefix-routingThis means that all front-end controllers are in a controller, and then the Admin_ prefix is used to differentiate whether it i
documents
Don't always stare at the manual. Wiki and API are also invaluable. The Development Guide in wiki is very useful, and the API documentation looks difficult at the beginning, but you will soon find that the information here is very important for you to create a CakePHP website. '
Use bake. php
Bake is a command line PHP script that can automatical
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.