我正试图用Sublime文本制作一个PHP构建系统,以便从编辑器在浏览器中运行PHP脚本。
这是我用来从sublime-text运行PHP脚本的构建系统。只要我在根Run
目录中有文件,/var/www/html
的工作都很好。
但是,如果文件位于子目录中,则此构建将失败。
即/var/www/html/SubDirectory
。
我使用正则表达式构建另一个变体 Run(SUB),用于运行子目录中的文件,但是如果我在多个子目录中有文件,则会失败。即/var/www/html/SubDirectory1/SubDirectory2
假设该网址为/var/www/html/Library/opac/index.php
,当我在浏览器中运行该网址时,它显示为localhost/opac/index.php
。
{
"cmd": ["php", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "embedding.php",
"variants":
[
{
"shell_cmd": "gnome-terminal -- bash -c \"php $file;echo;echo Press enter to exit...;read\"",
"name": "Run(terminal)"
},
{
"cmd":["firefox","localhost/$file_name"],
"name":"Run"
},
{
"cmd":["firefox","localhost/${file_path/.*[\\\/]//}/$file_name"],
"name":"Run(SUB)"
},
]
}
我想要一个正则表达式模式,该模式可在html /之后提取子URL。
如何始终在html之后提取子网址,以使网址变为 localhost/Library/opac/index.php