问题描述
我一直使用Delphi PHP XE2
。
文件夹的组织方式如下。
src / app_login.php
src / add
src / css
src / js
src / fnc $ b b src / db
src / images
等
我只是尝试 PHPSTORM
。包含文件工作正常。当我在Firefox中运行它时,它可以找到所有的图像,JavaScript文件等。但它找不到CSS文件,因为它是在
css
而不是
src / css
- 为什么浏览器现在查看绝对路径而不是相对路径?
- PHPStorm
-
编辑您的
hosts
strong>(或本地DNS服务器,如果首选并有一个),并将ProjectName
指向您的计算机IP(例如127.0.0.1 $ c $ (
In Place
)。 >应该做),配置它(提供所需的URL等 -http:// ProjectName:63342 /
)并将其标记为默认 - Why is the browser now looking at absolute path rather than relative?
- How did PHPStorm manage to tell it that?
- And how do I coerce it to treat them as relative paths?
Edit your
hosts
file (or local DNS server, if preferred and have one) and pointProjectName
to your computer's IP (e.g.127.0.0.1
).Create Deployment entry of correct type (
In Place
should do), configure it (provide desired URL etc --http://ProjectName:63342/
) and mark it as Default for this project -- now IDE will use URL from there when generating "open in browser" URLs.
$ b
我在浏览器中看到它运行它:
http:// localhost:63342 / SRC / app_login。 php
而不是
http:// localhost:63342 / app_login.php
问题。我如何强迫它向下移动一个目录级别?
我试图设置文件,以便在我键入时 wys.com
在浏览器中尝试运行它,并显示一个空白页。如果我输入 192.168.1.0
,它只是显示一个空白页。查看源不显示任何内容。我期待它运行 d:\wys\src
下的 index.html
。为什么浏览器不运行它?
您正在使用PhpStorm自己的简单内置Web服务器它使用 http:// localhost:63342 / ProjectName / app_login.php
的URL。你不能使用这样的服务器使 http:// localhost:63342 / app_login.php
,因为它将无法知道要提供什么文件。
使用自己的Apache / IIS /任何web服务器..或者内置服务器可以得到的最好的是 http: /ProjectName:63342/app_login.php
(IDE需要知道什么网站/文件服务不知何故)。为此:
I have been using "Delphi PHP XE2"
. The file structure has worked fine for over a year on the development machine and the production.
The folders are organised as follows.
src/app_login.php
src/add
src/css
src/js
src/fnc
src/db
src/images
etc.
I am just trying out PHPSTORM
. The include files work fine. When I run it in Firefox it can find all images, JavaScript files, etc. But it can not find the CSS files as it is looking for them in
css
rather than
src/css
I haven't changed anything.
I see that in the browser it runs it as:
http://localhost:63342/SRC/app_login.php
instead of
http://localhost:63342/app_login.php
I guess this the problem. How do I coerce it to move down one directory level?
I am trying to set up IIS, I think this might be best for later on. Here are the screen shots:
I configured the hosts file so that when I type wys.com
in the browser it tries to run it and shows a blank page. If I type in 192.168.1.0
it just shows a blank page. View Source shows nothing. I was expecting it to run the index.html
at d:\wys\src
. Why is the browser not running it?
You are using PhpStorm's own simple built-in web server which uses URLs like http://localhost:63342/ProjectName/app_login.php
. You cannot make http://localhost:63342/app_login.php
using such server as it will not be able to tell what files to serve.
Either use your own Apache/IIS/whatever web server .. or the best you can get with built-in server would be http://ProjectName:63342/app_login.php
(IDE needs to know what site/files to serve somehow). For that:
这篇关于如何让PHPStorm使用正确的路径CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!