http://www.123.com/api/index/index?type=xxx&user=1
index.php
class Index extends Controller
{
protected $user_id;
public function index(){
$this->user_id=input("get.user_id","0");
$type=input("get.type");
return $this->$type;
}
public function xxx(){
echo $this->user_id;
exit;
}
}这种方式的缺点就是一个文件太多方法了。。。快上百个函数,有没有办法接口入口地址不变的情况下拆分成多个文件?例如
index.php
class Index extends Controller
{
protected $user_id;
public function index(){
$this->user_id=input("get.user_id","0");
$type=input("get.type");
return $this->$type;
}
}
b.php
class b extends Controller
{
public function xxx(){
echo $this->user_id;
exit;
}
} 最佳答案