java - resetful 服务器设定返回http状态码
PHP中文网
PHP中文网 2017-04-18 09:31:19
0
1
678

在客户端请求到达服务器后,我会进行操作,如果请求数据操作失败(保存到数据库失败),我想返回客户端的状态码为400.这时候却一直是200,怎么修改状态码呢

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
Peter_Zhu

You can set the response result in the header, for example

header(‘HTTP/1.1 404 Not Found’);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!