我有一个基本的控制器操作:
public function createAction() {
$this->view->disable();
$formData = $this->request->getJsonRawBody();
$user = new Users();
$user->first_name = $formData->first_name;
$user->last_name = $formData->last_name;
$user->email_address = $formData->email_address;
$user->password = $formData->password;
// this prints to my debug log.
$result = $user->save();
AppLogger::$logger->debug(print_r($result, true)); // this does not print.
AppLogger::$logger->debug("oh boy #2"); // this does not print either.
// which seems to tell me that the line above it is problematic,
// but there is no error output from `phalcon serve`
echo Json::encode($result);
}
我看到的最接近错误的是:PHP/Phalcon Error: Closed without sending a request; it was probably just an unused speculative preconnection
.这出现在phalcon serve
的输出中。
我在Windows上的VSCode中运行phalcon serve
。
我通过将$result = $user->save();
包装在尝试/捕获中来解决此问题,然后我能够看到异常。
似乎此异常不会自动显示在终端输出中...
当用户尝试注销时遇到同样的问题,重新启动我的服务器(Laravel内置服务器(,它就像一个魅力。
如果要克隆Laravel项目,请确保已创建.env文件。它们有敏感信息,可能保存在.gitignore中。