似乎在使用$ _SERVER之类的PHP变量时,代码片段会忽略$。例如
{
// Example:
"IP Address Test": {
"scope": "php",
"prefix": "iptest",
"body": [
"// Debugging",
"if($_SERVER[\"REMOTE_ADDR\"]=='${1:ipaddress}'){",
"\t//run only my ip",
"\t$0",
"}"
],
"description": "Test only from IP address"
}
}
输出:
// Debugging
if(_SERVER["REMOTE_ADDR"]=='xxx.xxx.xxx.xxx'){
//run only my ip
}
您不能使用\,而必须使用double $ ..
例如。
// Debugging
if($$_SERVER["REMOTE_ADDR"]=='xxx.xxx.xxx.xxx'){
//run only my ip
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句