问题描述
如何在 PHPStorm 中创建一个实时模板来插入当前日期?
例如:
/**
* @author Person
* @time 27/07/2021
*/
解决方法
当然,只需使用提供的预定义 date()
和 time()
函数作为参数:
https://www.jetbrains.com/help/phpstorm/edit-template-variables-dialog.html#predefined_functions
实时模板文本:
/**
* @author Person
* @time $DATE$ $TIME$
*/
编辑变量(根据需要在可选参数中调整格式(使用 Java's SimpleDateFormat -- 请参阅上述链接中的函数说明)):
上述模板的示例结果:
/**
* @author Person
* @time 27/07/2021 15:39:01
*/