Python web开发给controller、action附加属性如何操作,pythoncontroller,在web开发过程中,有没
Python web开发给controller、action附加属性如何操作,pythoncontroller,在web开发过程中,有没
在web开发过程中,有没有一种方式给 controller 或 action 附加一种属性,类似给 controller 或 action 打上不同的 tag,用于区分不同的类型,如下:
/* * @Tags("All") */class UserController extends Controller { /* * @Tags("Read") */ public function index() { } /* * @Tags("Write") */ public function add() { } /* * @Tags("Write") */ public function foo() { }}
Java有annotation,问题在于你想怎么利用这些tag?
@All //也可以@Tags("All")class UserController extends Controller { @Read public Object index() { } @Write public Object add() { } @Write public Object foo() { }}
撸 C# 不? 里面有 Attribute 可以给成员进行标注。
python 也可以用装饰器来实现。
其他的就不熟了。
UPDATE: PHP 可以通过反射拿到注释,黑魔法……
ReflectionClass::getDocComment
Faking method attributes in PHP?
编橙之家文章,
相关内容
- 请问Python语言中is与双等号==有什么区别及作用,pytho
- Python终端中能输出带颜色的字符吗?,python终端,今天看
- Python语言method_descriptor语法正确解释是?,,type(str.cen
- Python字符串转数字有没有更好的方法,python字符串,py
- python Burpsuite,Wireshark,Fiddler 抓包的适用场景,以及优
- Python Django生成admin页中禁止模块部分功能如何实现,
- python sort()中cmp参数有什么要求,pythoncmp,最近在看<
- 需要提交JS表单,用python脚本能完成这项工作吗,jspyth
- 想用python splinter框架控制跳转页内容如何写,pythonspl
- mac系统不关闭终端如何停止python程序,mac终端停止pyt
评论关闭