tp5.0定义路由 +隐藏接口url地址

php

public function api(){
      return view();
    }
    public function manage($id){
       $test = input('id');
       if($test==1){
         $data = [
           'code' => '200',
           'title' => 'test',
           'api_mag' => '测试成功'
         ];
         echo json_encode($data);
       }else{
         echo json_encode('400');
       }
    }

Route

Route::rule('new','index/index/api');
Route::rule('api_index/:id','index/index/manage');

html





test






tp5.0定义路由 +隐藏接口url地址_第1张图片

 

你可能感兴趣的:(接口,php,ajax,jquery,tp5.0)