<?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请求处理代码 $name['name']=I('get.name'); $this->response($name,'json'); break; case 'put': // put请求处理代码 $name['name']=I('put.name1'); $this->response($name,'json'); break; case 'post': // post请求处理代码 $name['name']=I('post.name1'); $this->response($name,'json'); break; } }
炎藤3423424