如何在Adobe Brackets的Live Preview中运行php文件? [英] How to run php file in Live Preview on Adobe Brackets?

查看:104
本文介绍了如何在Adobe Brackets的Live Preview中运行php文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在php文件的括号中使用实时预览.是的,它在右下角设置为php,但仍然无法运行.我得到的只是一条错误消息:要启动带有服务器端文件的实时预览,您需要指定基本URL"

I can't use Live Preview on Brackets for my php file. Yes, it's set to php at the bottom right but it still doesn't run. All I get is an error message: "to launch live preview wit a server side file, you need to specify a base URL"

我正在使用MAMP运行localhost:8888,但是即使我将其输入baseURL,它仍然无法预览?

I am running my localhost:8888 with MAMP but even when I enter that into the baseURL it still doesn't preview?

我已经解决了问题-我忘了将php文件放到MAMP的htdocs文件夹中.现在,问题是当我从本地主机单击我的php文件时,它根本无法打开...有什么想法吗?

I've figured out the problem - I forgot to put my php file into the htdocs folder in MAMP. Now, the problem is that it simply doesn't OPEN when I click my php file from localhost...any ideas?

推荐答案

我遇到了类似的问题,不确定我的解决方案是否会对您有所帮助,因为我认为这可以解决.

I am having a similar problem, not sure if my solution will help yours as I think this is a work around.

我正在运行Wampserver来创建我的本地主机,并使用最新版本的PHP,并同意您的需要,将文件放在本地主机的根目录或子目录中.

I am running Wampserver to create my localhost and using the lastest version of PHP, and agree with you that you need to put the files in the root directory of the localhost or a subdirectory.

现在必须解决一个问题,不知道您是否也这样做-是要像这样指向我在括号.json文件中的php.exe:

Now one issue had to resolve, not sure if you did this too - was to point to my php.exe in the brackets.json file like so:

    "php": {
    "enablePhpTooling": true,
    "executablePath": "C:\\wamp64\\bin\\php\\php7.2.18\\php.exe",
    "memoryLimit": "4095M",
    "validateOnType": "false"
},

我还尝试通过以下方式首先使用项目设置运行实时预览:

I also tried running the live preview with project settings first with:

http://localhost/php (我保存了php文件的地方)

http://localhost/php (where I keep my php files)

,然后尝试使用指向相同目录的虚拟主机:

and then tried using a Virtual host pointing to the same directory:

myPHP.com

myPHP.com

两者都不能从Brackets上使用,尽管我可以使用Wampserver界面深入目录或VirtualServer,这使我能够编辑Brackets中的文件并仅使用浏览器进行测试,虽然不理想,但至少我可以学习我的代码如何工作或不工作.

Neither worked from Brackets, though I could use the Wampserver interface to drill into either the directory or VirtualServer which gave me the ability to edit the files in Brackets and just use the browser to test, not ideal but at least I can learn how my code is working or not.

然后我切换为实时预览",然后从文件"菜单中勾选已启用实验实时预览",发现我可以从根服务器目录(实际上是根目录中的子目录)启动作为项目在Brackets中打开的PHP文件.).基本上可以单击照明按钮来查看实际的网页.

I then switched of "Live Preview" and then ticked "Enabled Experimental Live Preview" from the File menu and found I could launch my PHP files I had opened as a project in Brackets from the root server directory (actually subdirectory in root). Essentially being able to click the lighting button to see the actual web page.

这篇关于如何在Adobe Brackets的Live Preview中运行php文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆