ciao a tutti,
non riesco a capire come mai non mi funziona questo include, è forse un problema di sintassi?
$percorso = 'http://localhost:8888/miosito/include/conn.php';
include ($percorso);
grazie!
ciao a tutti,
non riesco a capire come mai non mi funziona questo include, è forse un problema di sintassi?
$percorso = 'http://localhost:8888/miosito/include/conn.php';
include ($percorso);
grazie!
Io non vedo errori.
Il problema però potrebbe essere questo:
Controlla bene sul manuale: http://php.net/manual/en/function.include.phpWarning
Security warning
Remote file may be processed at the remote server (depending on the file extension and the fact if the remote server runs PHP or not) but it still has to produce a valid PHP script because it will be processed at the local server. If the file from the remote server should be processed there and outputted only, readfile() is much better function to use. Otherwise, special care should be taken to secure the remote script to produce a valid and desired code.
l'errore non è nella variabile in se ma nel percorso che deve essere assoluto di tipo
$percorso = '/var/www/miosito/include/conn.php';
e non http://
Regolo76
L'avevo pensato anche io, ma poi vedi l'esempio sul manuale:Originariamente inviato da regolo76
l'errore non è nella variabile in se ma nel percorso che deve essere assoluto di tipo
$percorso = '/var/www/miosito/include/conn.php';
e non http://
Codice PHP:
<?php
/* This example assumes that [url]www.example.com[/url] is configured to parse .php
* files and not .txt files. Also, 'Works' here means that the variables
* $foo and $bar are available within the included file. */
// Won't work; file.txt wasn't handled by [url]www.example.com[/url] as PHP
include 'http://www.example.com/file.txt?foo=1&bar=2';
// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';
// Works.
include 'http://www.example.com/file.php?foo=1&bar=2';
$foo = 1;
$bar = 2;
include 'file.txt'; // Works.
include 'file.php'; // Works.
si, ma credo che per poter funzionare debba essere abilitato (se non ricordo male) un qualcosa sul php.ini
Regolo76
ho capito ragazzi grazie!
se faccio riferimento a un file giustamente il percorso a cui mi devo rifare è quello dei file e non del http!