I installed the tutorial on this website to synthesize the swagger plug-in into ThinkPHP; https://github.com/fengdeqiao...
I found that this tutorial has many pitfalls, and errors will occur if you are not careful. I have now reached the fourth step of synthesis:
**
Step 4: Use swagger-php in thinkphp
**
If we have to manually execute the third step of the code every time we modify the API, which is a bit cumbersome, then we will write a method in the controller, execute it automatically every time we access swagger-ui, and then jump to the foreground swagger in the interface.
Note: Add require './vendor/autoload.php' to the thinkphp entry file index.php;
The following are the methods in the controller
$path = 'E:wamp64wwwtp'; //Which folder do you want the comments under to generate the corresponding API document?
$swagger = Swaggerscan($path);
//header('Content-Type: application/json' );
//echo $swagger;
$swagger_json_path = $path.'/swagger-docs/swagger.json';
$res = file_put_contents($swagger_path, $swagger);
if ($res == true) {
$this->redirect('http://localhost/swagger-ui/d...');
}
But when calling the scan() function, an error is reported, saying Class 'SwaggerStaticAnalyser' not found
Can any expert tell me how to modify it?
I installed the tutorial on this website to synthesize the swagger plug-in into ThinkPHP; https://github.com/fengdeqiao...
I found that this tutorial has many pitfalls, and errors will occur if you are not careful. I have now reached the fourth step of synthesis:
**
Step 4: Use swagger-php in thinkphp
**
If we have to manually execute the third step of the code every time we modify the API, which is a bit cumbersome, then we will write a method in the controller, execute it automatically every time we access swagger-ui, and then jump to the foreground swagger in the interface.
Note: Add require './vendor/autoload.php' to the thinkphp entry file index.php;
The following are the methods in the controller
$path = 'E:wamp64wwwtp'; //Which folder do you want the comments under to generate the corresponding API document?
$swagger = Swaggerscan($path);
//header('Content-Type: application/json' );
//echo $swagger;
$swagger_json_path = $path.'/swagger-docs/swagger.json';
$res = file_put_contents($swagger_path, $swagger);
if ($res == true) {
$this->redirect('http://localhost/swagger-ui/d...');
}
But when calling the scan() function, an error is reported, saying Class 'SwaggerStaticAnalyser' not found
Can any expert tell me how to modify it?
Thanks https://github.com/TIGERB/swa...