当我在类 RouteCollection 中设置日志时检测到错误
public function match(Request $request)
{
Log::debug('---------------------');
Log::debug('The request');
Log::debug('---------------------');
Log::debug($request->getMethod());
Log::debug('---------------------');
Log::debug($request->fullUrl());
Log::debug('---------------------');
$routes = $this->get($request->getMethod());
// First, we will see if we can find a matching route for this current request
// method. If we can, great, we can just return it so that it can be called
// by the consumer. Otherwise we will check for routes with another verb.
$route = $this->matchAgainstRoutes($routes, $request);
return $this->handleMatchedRoute($request, $route);
}
第一个请求的结果是:
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
[2021-10-28 21:55:54] testing.DEBUG: The request
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
[2021-10-28 21:55:54] testing.DEBUG: POST
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
[2021-10-28 21:55:54] testing.DEBUG: http://127.0.0.1/abcapp/api/auth/login
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
第二次的结果是:
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
[2021-10-28 21:55:54] testing.DEBUG: The request
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
[2021-10-28 21:55:54] testing.DEBUG: POST
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
[2021-10-28 21:55:54] testing.DEBUG: http://127.0.0.1/api/auth/login
[2021-10-28 21:55:54] testing.DEBUG: ---------------------
我的环境文件是:
APP_NAME=ABCApp
APP_ENV=local
APP_KEY=base64:HelloGuys!
APP_DEBUG=true
APP_URL=http://localhost/abcapp/
LOG_CHANNEL=daily
我的 env.testing 文件是:
APP_NAME=ABCApp
APP_ENV=local
APP_KEY=base64:HelloGuys!
APP_DEBUG=true
APP_URL=http://localhost/abcapp/
LOG_CHANNEL=daily
我解决了从 env.testing 更改 APP_URL 的错误:
APP_NAME=ABCApp
APP_ENV=local
APP_KEY=base64:HelloGuys!
APP_DEBUG=true
APP_URL=http://127.0.0.1/
LOG_CHANNEL=daily
之后我清除缓存。然后工作!