Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Aptana Ruby代码段上的转义斜杠_Ruby_Aptana_Code Snippets - Fatal编程技术网

Aptana Ruby代码段上的转义斜杠

Aptana Ruby代码段上的转义斜杠,ruby,aptana,code-snippets,Ruby,Aptana,Code Snippets,我试图在Aptana上创建一个新的代码段,如下所示: snippet "dump em arquivo" do |s| s.trigger = "debug" s.scope = 'source.php' s.expansion = "//debug file_put_contents('${2:/var/d_tmp/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});" end //debug file_put_co

我试图在Aptana上创建一个新的代码段,如下所示:

snippet "dump em arquivo" do |s|
  s.trigger = "debug"
  s.scope = 'source.php'
  s.expansion = "//debug
file_put_contents('${2:/var/d_tmp/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});"
end
//debug
file_put_contents('/var/d_tmp/debug.log', print_r(, true) . "\n", LOCK_EX);
但是在变量
${2:/var/d\u tmp/debug.log}
上,
/(斜杠)
用作选项列表,反斜杠也不起作用(
${2:\/var\/d\u tmp\/debug.log}

那么,我怎样才能避开斜杠,使代码段实际工作,输出整个字符串呢。 所需的输出应如下所示:

snippet "dump em arquivo" do |s|
  s.trigger = "debug"
  s.scope = 'source.php'
  s.expansion = "//debug
file_put_contents('${2:/var/d_tmp/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});"
end
//debug
file_put_contents('/var/d_tmp/debug.log', print_r(, true) . "\n", LOCK_EX);
找到了答案

例如,转义是用
两个反斜杠来完成的

snippet "dump em arquivo" do |s|
  s.trigger = "debug"
  s.scope = 'source.php'
  s.expansion = "//debug
file_put_contents('${2:\\/var\\/d_tmp\\/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});"
end