Jump to content
php.lv forumi

Pamata URL


Uldeens

Recommended Posts

Piemeram man saitam ir mapes

 

http://www.manalapa.lv/augli/

http://www.manalapa.lv/darzeni/

http://www.manalapa.lv/dzerieni/

 

includes http://www.manalapa.lv/in/ (connect.php , veelkautkas.php)

 

pamatlapa http://www.manalapa.lv/

 

No pamatlapas izsaucu

<? require("in/connect.php"); ....

viss iet

 

bet ja es izsaucu so no mapes darzeni

<? require("in/connect.php"); ....

tad require nestradaa tipa

jaizmanto pilnais URL

<? require("http://www.manalap.lv/in/connect.php") ...

 

Nav kautkads variablis globaalais lai var izmantot piemeram

 

require("$_SERVER['kautkas']/in/connect.php")

 

 

Kaa to realizee?

Edited by Uldeens
Link to comment
Share on other sites

vienkāršākais variants iekš config.php

define('ROOT_DIR','/var/www/');

 

talāk visos failos pieraksta relatīvo ceļu uz config.php bet citus failus includo ar require(ROOT_DIR.'in/connect.php');

Edited by v3rb0
Link to comment
Share on other sites

Tit kautkur lasiiju ka require ir atraaks.. bet nesaku ka taa tochna ir.

 

Bet dara vienu un to pashu .

Edited by Uldeens
Link to comment
Share on other sites

Include un require funkcijas praktiski sakrīt. Atšķirās tikai to "uzvedība", ja fails netiek atrasts. Include izdos warning, bet otrs - error, tātad skripts nomirs. :)

 

P.S. anyway RTFM!!!

Edited by GedroX
Link to comment
Share on other sites

×
×
  • Create New...