Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    variabile come parametro in include

    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!

  2. #2
    Io non vedo errori.
    Il problema però potrebbe essere questo:

    Warning
    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.
    Controlla bene sul manuale: http://php.net/manual/en/function.include.php

  3. #3
    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

  4. #4
    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://
    L'avevo pensato anche io, ma poi vedi l'esempio sul manuale:
    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.

  5. #5
    si, ma credo che per poter funzionare debba essere abilitato (se non ricordo male ) un qualcosa sul php.ini
    Regolo76

  6. #6
    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!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.