Home > Article > Backend Development > cakephp first cakephp entry basics
First, let’s take a look at the execution process of cakephp (picture borrowed from Baidu Encyclopedia):
1: First, your server must support rewrite. If it is a virtual host that does not support rewrite, cakephp will not run normally.
2: After directing all requests to the cakephp framework, you enter the framework's route. cakephp comes with a set of default distribution rules (for example: http://.../test/test, without any route configuration cakephp will automatically execute the test method in the test_controller controller).
We can direct any request to the controller and method we want to execute by configuring the route. The configuration is as follows (app/config/routes.php):
Copy the code The code is as follows:
Router: :connect('/pages/*', array('controller' => 'test', 'action' => 'index'));
Copy the code The code is as follows:
$this->test->find('all');
Copy the code The code is as follows:
if ($this->uses !== null && $this->uses !== false) {
$merge[] = 'uses';
}
foreach ($merge as $var) {
if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) {
if ($var !== 'uses') {
$normal = Set::normalize($this->{$var});
$app = Set::normalize($appVars[$var]);
if ($app !== $normal) {
$this->{$var} = Set::merge($app, $normal);
}
} else {
$this->{$var } = array_merge($this->{$var}, array_diff($appVars[$var], $this->{$var}));
}
}
}
The above introduces the basics of getting started with cakephp, the first version of cakephp, including the content of cakephp. I hope it will be helpful to friends who are interested in PHP tutorials.