Html 括号 - 实时预览不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25108420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:25:41  来源:igfitidea点击:

Brackets - Live Preview not working

htmlcsseditorreal-timeadobe-brackets

提问by Piju

I found this awesome program(html editor) called Brackets and it's by Adobe. Now reason why i got the editor was because i wanted to Live Preview PHP code, but i found out later that i needed a Wamp Server.

我发现了一个很棒的程序(html 编辑器),叫做 Brackets,它是由 Adob​​e 开发的。现在我得到编辑器的原因是因为我想实时预览 PHP 代码,但后来我发现我需要一个 Wamp 服务器。

Now, i was in the mood of making an about page but i couldn't live preview. Live Preview Base URL is empty, and when i try to live preview, i get this: > http://puu.sh/aDkET/4209ec1192.png< and the lightning bolt is half orange(i heard it needs to be red to work). I have tried the lot... Entering as Live Preview Base URL to http(semicolon)//localhost:(insertporthere)/ <-- Wamp Server, tried only localhost, left it empty, I don't know how to make this work.. I am stuck and i basically need real preview..

现在,我想制作一个关于页面,但我无法实时预览。实时预览基本 URL 为空,当我尝试实时预览时,我得到以下信息:> http://puu.sh/aDkET/4209ec1192.png< 并且闪电是半橙色(我听说它需要是红色才能工作)。我已经尝试了很多...作为实时预览基本 URL 输入 http(semicolon)//localhost:(insertporthere)/ <-- Wamp Server,只尝试了 localhost,将其留空,我不知道如何制作工作..我被卡住了,我基本上需要真正的预览..

Please, please help me! D: I have searched the internet looking for solutions, but no. If you can, a step-by-step tutorial would be much appreciated :)

拜托,请帮帮我!D:我在互联网上搜索过解决方案,但没有。如果可以,将非常感谢分步教程:)

Kind regards, - PiguFilms

亲切的问候, - PiguFilms

回答by peterflynn

The Live Preview "Base URL" is the localhost URL that corresponds to the root folderof your project. Brackets uses this to map from a local path on disk to the server URL which serves up that same file: it takes the HTML file's path relative to the project root, appends that relative path onto the Base URL, and then launches the resulting full URL in Chrome.

实时预览“基本 URL”是对应于项目根文件夹的本地主机 URL 。Brackets 使用它从磁盘上的本地路径映射到提供相同文件的服务器 URL:它获取 HTML 文件相对于项目根目录的路径,将该相对路径附加到基本 URL,然后启动生成的完整 URL在铬。

So, for example:

因此,例如:

  • If your page is at http://localhost/myapp/page.phpand the page.php file is in a "myapp" subfolder of your project, your base URL is just http://localhost/.
  • If your page is at http://localhost/myapp/page.phpand the page.php file is in the root of your project, your base URL is http://localhost/myapp/(this way the path is "/page.php" relative to both bases).
  • 如果您的页面位于http://localhost/myapp/page.php并且 page.php 文件位于项目的“myapp”子文件夹中,则您的基本 URL 只是http://localhost/.
  • 如果您的页面位于http://localhost/myapp/page.php并且 page.php 文件位于项目的根目录中,则您的基本 URL 是http://localhost/myapp/(这样的路径是相对于两个基地的“/page.php”)。

If you think you have the Base URL set correctly but it's still not working, try going to the same URL manually in your browser to make sure your server is operating correctly.

如果您认为基本 URL 设置正确,但仍然无法正常工作,请尝试在浏览器中手动访问相同的 URL,以确保您的服务器正常运行。

More details on using Live Preview with your own local server can be found here: https://github.com/adobe/brackets/wiki/How-to-Use-Brackets#lp-custom-server.

有关在您自己的本地服务器上使用实时预览的更多详细信息,请访问:https: //github.com/adobe/brackets/wiki/How-to-Use-Brackets#lp-custom-server

回答by Lahori

although @ytpete's answer is the right choice for your problem but you need to do, as i say, first. In simple words, go to file(in Brackets), click open folderand now make the project directory exactly same as your local host server for php files i.e. C:\Program Files\Ampps\www\phpFiles (i am using Ampps and here 'phpFiles' is a subfolder inside which relies my php file and also html file too). Now you can follow steps shown by ytpete and you are set to live preview of your php file.

尽管@ytpete 的答案是解决您问题的正确选择,但正如我所说,您首先需要做的是。简单来说,转到文件(在括号中),单击打开文件夹,现在使项目目录与 php 文件的本地主机服务器完全相同,即 C:\Program Files\Ampps\www\phpFiles(我正在使用 Ampps 和这里'phpFiles' 是其中的一个子文件夹,它依赖于我的 php 文件和 html 文件)。现在您可以按照 ytpete 显示的步骤进行操作,并设置为实时预览您的 php 文件。

回答by scott.schaffer

I had this problem as well. What I did was simply goto File->Open Folder... it all worked after all the necessary files were loaded into Brackets.

我也有这个问题。我所做的只是转到“文件”->“打开文件夹”……在将所有必要的文件加载到 Brackets 后,一切都奏效了。

回答by qwerty

If you are using windows try running brackets "As administrator", worked for me

如果您使用的是 Windows,请尝试运行方括号“以管理员身份”,这对我有用

回答by JetSet

I had this same issue once I installed Xampp. This videoresolved it for me. Essentially just select, File > 'Enable Experimental Live Preview' should have a check mark.

安装 Xampp 后,我遇到了同样的问题。这个视频为我解决了这个问题。基本上只需选择,文件 > '启用实验性实时预览'应该有一个复选标记。

回答by Smartniggs

This worked for me. I restarted my system and then unchecked "enable experimental live preview" in file.

这对我有用。我重新启动了系统,然后在文件中取消选中“启用实验性实时预览”。

回答by Miki Bakaiki

this worked for me, and i don't remember where i saw it, but go to : cd $HOME/.local/share/applicationsand delete everything chrome related.

这对我有用,我不记得我在哪里看到的,但请转到:cd $HOME/.local/share/applications并删除与 chrome 相关的所有内容。

This worked for me, and i didn't dare to use live preview again.

这对我有用,我不敢再次使用实时预览。

On Ubuntu 16.04 LTS and Chrome Version 61.0.3163.100 (Official Build) (64-bit)

在 Ubuntu 16.04 LTS 和 Chrome 版本 61.0.3163.100(官方版本)(64 位)上

回答by Aman Rathore

Put your files in the same folder where you have index.html file

将您的文件放在您拥有 index.html 文件的同一文件夹中

回答by Udaya Chathuranga

I have selected the option called "reload with extension" from Bracket's debug menu and that resolved live preview issue. More details can be found here.

我从 Bracket 的调试菜单中选择了名为“使用扩展重新加载”的选项,并解决了实时预览问题。可以在此处找到更多详细信息。

回答by martin

Make sure you don't have an internet bandwidth limiter (such as NetLimiter) running while using Brackets' Live preview.

确保在使用 Brackets 的实时预览时没有运行 Internet 带宽限制器(例如 NetLimiter)。