In this chapter I create 4 addition, subtraction, multiplication and division equations. If the route is not set, there will always be a page error, but if the routing rules are set in the route, addition, subtraction, multiplication, and division can be performed and displayed. Why is this?
This is the addition I intercepted
<?php
namespace app\index\controller;
class Demon{
public function add($n,$m){
return $n.' '.$m.'='.($n $m);
}
}
If the route is not set in route, there will always be a page error. But if I set the route
think\Route::get('add/:n/:m','index/demon/add');
, the addition can be displayed. I have repeatedly tested the path using other expressions, and there is no problem?
You will understand once you understand routing. The method request is the location of the routing settings. There must be something wrong if you follow the video and write the route or not