havocera 17d3d24b6d 提交vendor | 1 year ago | |
---|---|---|
.. | ||
src | 1 year ago | |
.gitignore | 1 year ago | |
README.md | 1 year ago | |
composer.json | 1 year ago |
composer require topthink/think-annotation
配置文件位于
config/annotation.php
<?php
namespace app\controller;
use think\annotation\Inject;
use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use think\annotation\route\Resource;
use think\Cache;
use think\middleware\SessionInit;
/**
* Class IndexController
* @package app\controller
* @Group("bb")
* @Resource("aa")
* @Middleware({SessionInit::class})
*/
class IndexController
{
/**
* @Inject()
* @var Cache
*/
protected $cache;
public function index()
{
//...
}
/**
* @Route("xx")
*/
public function xx()
{
//...
}
}
Some IDEs already provide support for annotations: