PHP code example of cshaptx4869 / webman-annotation
1. Go to this page and download the library: Download cshaptx4869/webman-annotation 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/ */
cshaptx4869 / webman-annotation example snippets
use Fairy\AnnotationScanner;
$scanner = new AnnotationScanner();
$scanner->registerRoute();
namespace app\controller;
use Fairy\Annotation\Route;
use support\Request;
class Index
{
/**
* 通过get或者post方式请求 /json 即可访问到当前控制器方法
* @Route(url="/json", method="GET")
*/
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}