1. Go to this page and download the library: Download mano-code/custom-extend library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Illuminate\Support\Facades\Route;
Route::any('/demo',function(){
return ['msg'=>'HelloWorld'];
});
Route::get('/test',[ManoCode\FileSystem\Http\Controllers\DemoApiController::class,'test']);
Route::get('/test1',[ManoCode\FileSystem\Http\Controllers\DemoApiController::class,'test1']);
namespace ManoCode\FileSystem\Http\Controllers;
use Illuminate\Routing\Controller;
use ManoCode\CustomExtend\Traits\ApiResponseTrait;
/**
*
*/
class DemoApiController extends Controller
{
use ApiResponseTrait;
public function test()
{
return $this->success('测试成功',[
'list'=>[]
]);
}
public function test1()
{
return $this->fail('错误',[
'list'=>[]
]);
}
}