我正在RESTFUL
为 codeigniter 使用 Phil Sturgeons 库。但我对 POST 方法有疑问。
$this->post('name');
当我尝试捕获该值时,上面的代码总是返回 null。
这是我的要求:
Request Url: http://localhost/api_rest/login
Request Method: POST
Status Code: 400
Params: {
"email": "example@email.com",
"password": "balbala"
}
:
function login_post()
{
if(!$this->post('email') || !$this->post('password')){
$this->response(array('error' => 'Email and Password leave blank'),400);
}
是的,它的返回状态码:400 because $this->post('email') or $this->post('password')
绝对返回false
。
也许你应该知道我的错误:
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found</p>
<p>Filename: libraries/Format.php</p>
<p>Line Number: 230</p>
</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: simplexml_load_string(): email=sahal%40seratuscompany.com&password=123456</p>
<p>Filename: libraries/Format.php</p>
<p>Line Number: 230</p>
</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: simplexml_load_string(): ^</p>
<p>Filename: libraries/Format.php</p>
<p>Line Number: 230</p>
</div>{"error":"Email and Password leave blank"}
有人对这个东西有想法吗?