>  기사  >  백엔드 개발  >  Sublime Text中运作PHP(转)

Sublime Text中运作PHP(转)

WBOY
WBOY원래의
2016-06-13 12:34:09971검색

Sublime Text中运行PHP(转)

Sublime Text 2 has the concept of build systems. This basically means that if you are editing a Python file then you can run the Python interpreter on the source file your are editing and see the output in a console window, all without having to leave the Sublime editor. It’s surprising how much quicker and easier this is compared to having to leave Sublime to swap to a?separate?console window. This is Sublime’s Tools->Build System menuPHP Build Sublime Text 2Surprisingly, there is no supplied build system for PHP, to add one go to “New Build System”. A new tab opens for file?untitled.sublime-build?with the following in it:

{ “cmd”: [“make”] }

Delete that and replace it with this:

{ “cmd”: [“php”, “$file”], “file_regex”: “php$”, “selector”: “source.php” }

And save the file. Sublime will pop up the file save dialog, which defaults to the directory that Sublime uses for its user-generated config files, so don’t change the directory, just save this file as?php.sublime-build. Now, when you edit a file whose name ends with?php?(as specified by the “php$” regex in the config file) you will have a build system available. You can now hit CTRL+B and the PHP?interpreter?will run against your source file and the output appears in a Sublime Text window.Sublime Text build PHPThe grey window shows the output of the PHP interpreter and the time it took to run.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.