💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 响应状态 Every HTTP response has a numeric [status code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html). The status code identifies the*type*of HTTP response to be returned to the client. The PSR-7 Response object’s default status code is`200`(OK). You can get the PSR-7 Response object’s status code with the`getStatusCode()`method like this. > 每个HTTP响应都有一个数字 [status code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)。状态代码标识要返回给客户机的HTTP响应的类型。PSR-7响应对象的默认状态代码是`200`(OK)。可以使用`getStatusCode()`方法获得PSR-7响应对象的状态代码,如下所示。 ~~~php $status = $response->getStatusCode(); ~~~ Figure 3: Get response status code. You can copy a PSR-7 Response object and assign a new status code like this: > 您可以复制一个PSR-7响应对象并分配一个新的状态码,如下所示: ~~~php $newResponse = $response->withStatus(302); ~~~ Figure 4: Create response with new status code.