Sublime text 的有用 Yii2 代码片段
导航
安装
安装包有几种方法。
在 软件包控制 中搜索 Yii2 代码片段。
将仓库克隆到您的 Sublime Text 2/3 软件包目录中。 git clone https://github.com/psy-man/yii2-snippets.git
注意: 您可以通过转到首选项 -> 浏览软件包来找到您的软件包目录。
Yii
方法 |
代码片段 |
t |
Yt |
setAlias |
Ysa |
getAlias |
Yga |
Html
方法 |
代码片段 |
encode |
He |
a |
Ha |
mailto |
Hmail |
img |
Himg |
label |
Hl |
button |
Hb |
submitButton |
Hsb |
resetButton |
Hrb |
input |
Hi |
submitInput |
Hsi |
resetInput |
Hri |
textInput |
Hti |
hiddenInput |
Hhi |
passwordInput |
Hpi |
fileInput |
Hfi |
textarea |
Hta |
radio |
Hrd |
checkbox |
Hcb |
dropDownList |
Hdl |
listBox |
Hlb |
checkboxList |
Hcbl |
radioList |
Hrdl |
activeLabel |
Hal |
activeHint |
Hah |
errorSummary |
Hes |
error |
Herr |
activeInput |
Hai |
activeTextInput |
Hati |
activeHiddenInput |
Hahi |
activePasswordInput |
Hapi |
activeFileInput |
Hafi |
activeTextarea |
Hata |
activeRadio |
Hard |
activeCheckbox |
Hacb |
activeDropDownList |
Hadl |
activeListBox |
Halb |
activeCheckboxList |
Hacbl |
activeRadioList |
Hardl |
ActiveField
方法 |
代码片段 |
textInput |
AFti |
hiddenInput |
AFhi |
passwordInput |
AFpi |
fileInput |
AFfi |
textarea |
AFta |
radio |
AFrd |
checkbox |
AFcb |
dropDownList |
AFdl |
listBox |
AFlb |
checkboxList |
AFcbl |
radioList |
AFrdl |
widget |
AFw |
ArrayHelper
方法 |
代码片段 |
toArray |
AHta |
merge |
AHm |
getValue |
AHgv |
remove |
AHr |
index |
AHi |
getColumn |
AHgc |
map |
AHmap |
keyExists |
AHke |
multisort |
AHsort |
htmlEncode |
AHe |
FileHelper
方法 |
代码片段 |
normalizePath |
FHnp |
localize |
FHl |
getMimeType |
FHgmt |
getMimeTypeByExtension |
FHgmtbe |
getExtensionsByMimeType |
FHgebmt |
copyDirectory |
FHcpd |
removeDirectory |
FHrd |
findFiles |
FHff |
filterPath |
FHfp |
createDirectory |
FHcd |
Url
方法 |
代码片段 |
toRoute |
Utr |
to |
Ut |
base |
Ub |
remember |
Ur |
previous |
Up |
current |
Uc |
home |
Uh |
isRelative |
Uir |
Json
方法 |
代码片段 |
encode |
Je |
htmlEncode |
Jhe |
decode |
Jd |
StringHelper
方法 |
代码片段 |
byteLength |
SHbl |
byteSubstr |
SHbs |
basename |
SHbn |
dirname |
SHdn |
truncate |
SHtr |
truncateWords |
SHtrw |
startsWith |
SHsw |
endsWith |
SHew |
explode |
SHexp |
Request
方法 |
代码片段 |
resolve |
Rres |
headers |
Rh |
method |
Rm |
isGet |
Rig |
isOptions |
Rio |
isHead |
Rih |
isPost |
Rip |
isDelete |
Rid |
isPut |
Riput |
isPatch |
Ripatch |
isAjax |
Ria |
isPjax |
Ripj |
isFlash |
Rif |
rawBody |
Rrb |
setRawBody |
Rsrb |
bodyParams |
Rbps |
setBodyParams |
Rsbps |
getBodyParam |
Rbp |
post |
Rp |
queryParams |
Rqps |
setQueryParams |
Rsqps |
get |
Rg |
getQueryParam |
Rqp |
hostInfo |
Rhi |
setHostInfo |
Rshi |
baseUrl |
Rbu |
setBaseUrl |
Rsbu |
absoluteUrl |
Rau |
url |
Ru |
setUrl |
Rsu |
queryString |
Rqs |
isSecureConnection |
Risc |
serverName |
Rsm |
serverPort |
Rsp |
referrer |
Rref |
userAgent |
Rua |
userIP |
Ruip |
userHost |
Ruh |
cookies |
Rcook |
getCsrfToken |
Rcsrf |
csrfTokenFromHeader |
Rcsrfh |
validateCsrfToken |
Rcsrfv |
User
方法 |
代码片段 |
identity |
Ui |
switchIdentity |
Usi |
login |
Ul |
loginByAccessToken |
Ulbat |
logout |
Ulogout |
isGuest |
Uig |
id |
Uid |
getReturnUrl |
Ugru |
setReturnUrl |
Usru |
loginRequired |
Ulr |
can |
Ucan |
Session
方法 |
代码片段 |
open |
Sop |
close |
Scl |
destroy |
Sdesr |
isActive |
Sia |
hasSessionId |
Shsi |
setHasSessionId |
Sshsi |
id |
Sid |
setId |
Ssid |
regenerateID |
Srgid |
name |
Sname |
setName |
Ssname |
savePath |
Ssp |
setSavePath |
Sssp |
cookieParams |
Scp |
setCookieParams |
Sscp |
useCookies |
Suc |
setUseCookies |
Ssuc |
openSession |
Sos |
closeSession |
Scs |
readSession |
Sread |
writeSession |
Swrite |
destroySession |
Sdestroy |
count |
Scount |
get |
Sget |
set |
Sset |
remove |
Sremove |
removeAll |
SremoveAll |
has |
Shas |
getFlash |
Sfl |
addFlash |
Safl |
setFlash |
Ssfl |
removeFlash |
Srfl |
removeAllFlashes |
Srafl |
hasFlash |
Shfl |
Cache
方法 |
代码片段 |
buildKey |
Cbk |
get |
Cg |
exists |
Ce |
mget |
Cmg |
set |
Cs |
mset |
Cms |
madd |
Cma |
add |
Ca |
delete |
Cd |
flush |
Cf |
offsetExists |
Coe |
offsetGet |
Cog |
offsetSet |
Cos |
offsetUnset |
Cou |
Active Record
方法 |
代码片段 |
find |
Mf |
find-all |
Ma |
find-one |
Mo |
find-count |
Mc |
find-exists |
Me |
find-max |
Mmax |
find-min |
Mmin |
model-findOne |
Mfo |
model-findAll |
Mfa |
model-findBySql |
Mbs |
model-updateAll |
Mua |
model-updateAllCounters |
Muac |
model-deleteAll |
Mda |
数据显示
方法 |
代码片段 |
ListView |
Lw |
GridView |
Gw |
GridView Column |
Gwc |
LinkPager |
Lp |
echo translate |
Yte |
HtmlPurifier |
HPp |
Base Yii
方法 |
代码片段 |
user |
Yu |
controller |
Yc |
action |
Ya |
params |
Yp |
end |
Ye |
注册
方法 |
代码片段 |
registerJs |
Yrj |
registerJsFile |
Yrjf |
registerCss |
Yrc |
registerCssFile |
Yrcf |
registerMetaTag |
Yrmt |
渲染
方法 |
代码片段 |
render |
RD |
renderHtml |
RDh |
renderPartial |
RDp |
renderAjax |
RDa |
行为
方法 |
代码片段 |
behaviors |
Beh |
TimestampBehavior |
Beht |
SluggableBehavior |
Behs |
BlameableBehavior |
Behb |
验证规则
方法 |
代码片段 |
required |
Vr |
email |
Ve |
trim |
Vt |
default |
Vd |
boolean |
Vb |
captcha |
Vcapt |
compare |
Vcomp |
date |
Vdt |
double |
Vdb |
each |
Veach |
exist |
Vex |
file |
Vf |
in |
Vin |
integer |
Vi |
number |
Vn |
match |
Vc |
safe |
Vsf |
string |
Vs |
unique |
Vuni |
url |
Vu |
数据库迁移
方法 |
代码片段 |
execute |
DMe |
createTable |
DMct |
dropTable |
DMdt |
truncateTable |
DMtt |
renameTable |
DMrt |
addColumn |
DMac |
dropColumn |
DMdc |
renameColumn |
DMrc |
alterColumn |
DMalc |
addPrimaryKey |
DMapk |
dropPrimaryKey |
DMdpk |
addForeignKey |
DMafk |
dropForeignKey |
DMdfk |
createIndex |
DMci |
dropIndex |
DMdi |
insert |
DMi |
batchInsert |
DMbi |
update |
DMu |
delete |
DMd |
数据库模式
方法 |
代码片段 |
primaryKey |
DSpk |
bigPrimaryKey |
DSbpk |
string |
DSs |
text |
DSt |
smallInteger |
DSsi |
integer |
DSi |
bigInteger |
DSbi |
float |
DSf |
double |
DSd |
decimal |
DSdc |
money |
DSm |
dateTime |
DSdt |
timestamp |
DSts |
time |
DStime |
date |
DSdt |
boolean |
DSbool |
binary |
DSbin |
其他
方法 |
代码片段 |
ActiveDataProvider |
Adp |
transaction |
Tra |
待办事项
添加 ListView, GridView 等等…
添加缓存
添加“渲染”代码片段
添加带有参数的查找模型
添加数据提供器
添加默认行为(TimestampBehavior 等…)
添加验证规则
添加数据库迁移
许可
Yii2 简介 是开源软件,受 MIT 许可证 许可。
PS
如果您有改进这个包的想法或发现了任何错误,请通过 Github 联系我。