问题
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.
- 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?
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?
回答1:
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:
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.
来源:https://stackoverflow.com/questions/30053204/how-do-i-get-phpstorm-to-use-the-correct-path-for-css