[英]Sublime Text 3 - PHP Build System
掙扎了很多。
試圖添加一個PHP構建系統,這就是我所擁有的:
{
"cmd" : ["php", "$file"],
"file_regex": "php$",
"selector" : "source.php"
}
現在,構建一個名為test.php
的文件,其中包含: <?php echo "Hello, World!"; ?>
<?php echo "Hello, World!"; ?>
產生此錯誤:
[WinError 2] The system cannot find the file specified
[cmd: ['php', 'D:\\www\\sandbox\\php\\test.php']]
[dir: D:\www\sandbox\php]
PHP絕對在我的PATH
並通過命令行運行php test.php
。
誰能在這里闡明一些想法?
PHP.sublime-build:
{
"cmd": ["C:\\php\\php.exe", "$file"],
"file_regex": "php$",
"selector": "source.php"
}
在此唯一的php.exe路徑(“ C:\\ php \\ php.exe”)中使用Varialble。 保存后,在您的PHP代碼上按F7。 希望這對某人有幫助。
您只需要更改php.exe的路徑即可。 例如我使用wampserver,所以我的php.exe在C:\\wamp64\\bin\\php\\php5.6.16
,這樣的解決方案是:
{
"cmd": ["C:\\wamp64\\bin\\php\\php5.6.16\\php.exe", "$file"],
"file_regex": "php$",
"selector": "source.php"
}
這對我來說很好,祝你好運:)
修改后的代碼:
{
"cmd": ["C:\\xampp\\php\\php.exe", "$file"],
"file_regex": "*",
"selector": "source.php"
}
這是我用來在終端機/瀏覽器中運行php腳本的構建系統。
{
"shell_cmd": "php -l \"$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)"
},
{
"shell_cmd":"firefox \"localhost/$file_base_name.php\"",
"name":"Run on Server"
}
]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.