如何能让php文件在sublime text中用浏览器打开后预览

如题所述

配置在Chrome,Firefox中打开

安装 SideBarEnhancements(packages control-> 输入install packages-> SideBarEnhancements能找到这个插件)
然后通过ctrl + k, ctrl + b打开侧边栏,在侧边栏的html文件上右击,找到 open width -> edit applications
然后在这里边设置firefox打开的方式。

application : 路径要修改为自己默认安装的路径。
[
{"id": "side-bar-files-open-with",
"children":
[
//application firefox
{
"caption": "firefox",
"id": "side-bar-files-open-with-firefox",

"command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "D:\\Program Files\\Mozilla Firefox\\firefox.exe",
"extensions":".*" //any file with extension
}
},

{"caption":"-"},
{
"caption": "chrome",
"id": "side-bar-files-open-with-chrome",

"command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
"extensions":".*" //any file with extension
}
}
]
}
]
设置快捷键
Key bindings -> User

[
{ "keys": ["ctrl+shift+c"], "command": "copy_path" },
{ "keys": ["alt+f12"], "command": "open_in_browser" },
{ "keys": ["f12"], "command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "D:\\Program Files\\Mozilla Firefox\\firefox.exe",
"extensions":".*" //any file with extension
} },
{ "keys": ["ctrl+f12"], "command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
"extensions":".*" //any file with extension
}
}

]
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-08-22
php文件不可以像html文件直接打开,要用到本地服务器,通过流量器访问localhost、去访问php文件

服务器在本地安装WampServer软件,在www的文件夹里放php文件,在流量器访问localhost/文件.php就可以了
第2个回答  2017-04-01

SUBLIME不能直接预览喔,但是可以给些小建议:

    把SUBLIME,浏览器锁定到任务栏

    当你需要预览把文件拖到浏览器上就行

    当你需要编辑的时候拖到SUBLIME上

第3个回答  2016-12-27

    在本地装一个集成环境 phpstudy 或者 wampserver 

    装好运行环境之后,把你的php文件放到装好的环境下的WWW文件夹下面

    例如你的php文件名是index.php   那么运行你的集成环境

    打开浏览器,在地址栏写上localhost,看到index.php文件,点开即可

第4个回答  2017-02-18
php 不是静态的语言。不能直接预览。
你必须要有一个后台服务器。
sublime text 里面有其他类似的plugin帮助你刷新,打开页面,但是前提是你要有一个能解析php的服务器。
相似回答