Jump to content
php.lv forumi

domēna faila lietošana no vairākiem domēniem


ray

Recommended Posts

Man uz viena domēna www.example.com stāv php faili. Vai ir iespējams un kā es tos varētu izsaukt un lietot no citiem domēniem (www.domain.com, www.mans_domēns.lv, utt.), ja tie stāv uz viena (mana) servera?

 

Piem.

www.example.com/index.php

function bla($mainigais) {
return $mainigais;
}

www.domain.com/default.php

include("index.php"); // te ir tas pirmais fails no cita domēna (www.example.com)
echo bla("HELLO!");

Edited by ray
Link to comment
Share on other sites

http://lv2.php.net/include/:

If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
Link to comment
Share on other sites

Ja tev viss stāv uz servera tad jau vari inklūdot pa taisno failu, nevis caur urli. Tb include("/http_server/public_html/domain.com/default.php");

Nav man bijusi vajadzības, bet manuprāt, teorētiskā līmenī tas strādā.

Link to comment
Share on other sites

Tb include("/http_server/public_html/domain.com/default.php");

es jau mēģināju, bet man rādīja, ka nav atļauja (permission).

 

man vnk vajag pāris php failus vienādus vairākiem domēniem, kurus negribas katram kopēt pa jaunu pēc katrām izmaiņām.

Edited by ray
Link to comment
Share on other sites

×
×
  • Create New...