<?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;
}
}

最佳答案
