我用restful写了一个接口,但是接收不到post过来的json值

浏览:9898 发布日期:2016/03/07 分类:求助交流 关键字: restful
请问我改怎么获取post过来的值呢?<?php
namespace Api\Controller;
use Think\Controller\RestController;

class UserController extends RestController
{
    protected   $allowOutputType=   array(
        //'xml' => 'application/xml',
        'json' => 'application/json',
        //'html' => 'text/html',
    );

    public function login()
    {
        switch ($this->_method)
        {
            case 'get': // get请求处理代码
                if ($this->_type == 'html'){
                }elseif($this->_type == 'xml'){
                }
                break;
            case 'put': // put请求处理代码
                break;
            case 'post': // post请求处理代码
                    $name['name']=I('post.name');
                    $this->response($name,'json');
                break;
        }
    }

最佳答案
评论( 相关
后面还有条评论,点击查看>>