I install this site tutorial to the swagger plug-in synthesis into thinkphp; Https://github.com/fengdeqiao ...
Found this tutorial a lot of pits, accidentally will be wrong. I have now synthesized to the fourth step:
**
Fourth step: Use swagger-php in thinkphp
**
If we modify the API every time, but also to manually execute the third step of the code, some cumbersome, then we will write a method in the controller, each access to Swagger-ui automatically, and then jump to the foreground swagger interface.
Note: Add require './vendor/autoload.php ' to Thinkphp's entry file index.php;
Here's how it's inside the controller.
$path = ' E:WAMP64WWWTP '; Which folder do you want the following comment 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 call the scan () function to error, saying that Class ' swaggerstaticanalyser ' not found
Which master can tell me how to modify!
Reply content:
I install this site tutorial to the swagger plug-in synthesis into thinkphp; Https://github.com/fengdeqiao ...
Found this tutorial a lot of pits, accidentally will be wrong. I have now synthesized to the fourth step:
**
Fourth step: Use swagger-php in thinkphp
**
If we modify the API every time, but also to manually execute the third step of the code, some cumbersome, then we will write a method in the controller, each access to Swagger-ui automatically, and then jump to the foreground swagger interface.
Note: Add require './vendor/autoload.php ' to Thinkphp's entry file index.php;
Here's how it's inside the controller.
$path = ' E:WAMP64WWWTP '; Which folder do you want the following comment 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 call the scan () function to error, saying that Class ' swaggerstaticanalyser ' not found
Which master can tell me how to modify!
No https://github.com/TIGERB/swa ...