How does one specify pathnames correctly in PHP? -


I am projecting a small home computing in PHP and making reference in this way ...

  & lt; A href = \ "list_beer.php? Order_by = name \" & gt; Beer & lt; / A & gt;  

This starts to choose the correct file when I'm in it, I need a pathname.

  include_once ("/var/www/common.php");  

I'm sure this can not be true. Maybe you can tell me what is the best practice for these things, so that I can create such a script which is a special pathname (or operating Are not connected to the system) and because the file selected in the first instance can be controlled? Maybe some settings php.ini or apache?

Thank you.

Basically, you need a complete path for both

Web For resources, this web site must start with root - /

For files, you need a point where the virtual path meets a file system. Br> $ _ server ['DOCUMENT_ROOT'] is for that purpose

such as

  & lt; A href = "/ list_beer.php? Order_by = name" & gt; Beer & lt; / A & gt;  

and

  include_once ($ _SERVER ['DOCUMENT_ROOT']. "/ Common.php");  

will work as desired


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -