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 for future reference. due to the limited level, there will inevitably be some errors and deficiencies. welcome to the well-intentioned cakephp Manual Series 1: configure the cakephp method
I have been using the cakephp development project for more than a year. I think back to the scenario where the configuration was copied by video at the beginning. I feel that the progress is indeed not small, so now I want to summarize the various problems encountered during the learning and development process as a manual for future reference. due to the limited level, there will inevitably be some errors and deficiencies, thank you for your good faith in correction and correction.
? ? Configuring cakephp is a prerequisite for using it for development. I have been suffering from this problem for a long time, because of the shortcomings of the tutorial and some negligence of the videos I have watched, as a result, it took me several days to start configuring cakephp and sweated. In fact, configuring cakephp is very simple and can be divided into the following steps.
1. Download
? ? Currently, the stable cakephp version used for development is 1.3.12. can I download it from the official website of cakephp? : Www.cakephp.org
? ? Decompress the downloaded files and put them in the project directory of your server, such as apache htdocs. the extracted root directory should contain the following files/folders:
1. app2. cake3. vendors4. .htaccess5. index.php6. README
?
?
2. configure the app/config/core. php file
? ? ??Modify code
Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
? ? ? ? ? Change
Configure::write('Security.salt', 'ABDCDEFGHIKLMNOPQRSTUVWXYZ');
? ? ? ? ? After
Configure::write('Security.cipherSeed', '76859309657453542496749683645');
? ? ? ? ? Enter a few numbers at will, for example
Configure::write('Security.cipherSeed', '76859309657453asdfsdf6749683645');
? ? ? ? ? To match with the local environment.
?
?
3. configure app/config/database. php
? ? ? ? Database. php is renamed by database. php. default. it is mainly used to configure the connection with the database. the configuration information is as follows:
?
var $default = array( 'driver' => 'mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'root', 'password' => 'root', 'database' => 'test', 'encoding'=>'utf8' );
? ? ? ? ? Login is the mysql database logon name, password is the password, database is the default connected database, and encoding is the encoding.
?
?
4. (optional) configure app/config/routes. php
? ? ? If you want to change the default access page (that is, you can modify the default access page after entering localhost)
?
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
? ? ? ? ? Set controller to the default controller and action to the default action, for example
?
Router::connect('/', array('controller' => 'messages', 'action' => 'upload'));
? ? ? ? ? Indicates the default access to messages/upload
?
?
5. (optional) configure cake/libs/controller. php
? ? ? ? ? The default views Editing page of cakephp is in the ctp format, which is inconvenient to edit in DM. Therefore, I will change the default editing page to html or htm format, which is convenient for front-end artists to modify.
?
var $ext = '.ctp';
? ? ?? Change
?
var $ext = '.htm';
? ? ? ?? As a matter of fact, it is no problem to run cakephp after the first three steps have been completed. The next step is just your habitual modification. you can make modifications based on your habits and specific project requirements. I will not go into details.