Visualizzazione dei risultati da 1 a 4 su 4

Discussione: header

  1. #1

    header

    sul mio pc l'header funziona

    sul server non va
    io su un file faccio eseguire l'operazione e alla fine vorrei trasferire la pagina su un altro file senza nessun clic
    ho scritto
    header("Location:nomefile.php");

    ma non funge
    cosa può essere?
    www.moscabianca.biz- riusciremo a competere con i colossi dell'annuncio? un sogno che arriva dal basso

  2. #2
    devi scrivere tutto il percorso in location:
    dal mio manuale


    header("Location: http://www.php.net/"); /* Ridireziona il browser
    al sito di PHP */
    exit; /* Assicura che il codice sottostante
    non sia eseguito dopo il redirezionamento. */



    Nota: HTTP/1.1 richiede un URI assoluto come argomento di Location: composto da schema, hostname, e path assoluto, ma alcuni clients possono accettare anche URIs relativi. E' possibile usare $HTTP_SERVER_VARS['HTTP_HOST'], $HTTP_SERVER_VARS['PHP_SELF'] e dirname() per creare URI assoluti da URI relativi in modo automatico:

  3. #3

    ob_start()

    no nè quello il prob
    ma i lfatto che cambio header ma non so come poter cambiare hedaer senza provocare errore
    ob_start() può essere una soluzione ma non so usarlo
    www.moscabianca.biz- riusciremo a competere con i colossi dell'annuncio? un sogno che arriva dal basso

  4. #4
    sempre dal mio manuale:

    ob_start

    (PHP 4 , PHP 5)

    ob_start -- Turn on output buffering
    Description
    bool ob_start ( [callback output_callback])


    This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

    The contents of this internal buffer may be copied into a string variable using ob_get_contents(). To output what is stored in the internal buffer, use ob_end_flush(). Alternatively, ob_end_clean() will silently discard the buffer contents.

    An optional output_callback function may be specified. This function takes a string as a parameter and should return a string. The function will be called when ob_end_flush() is called, or when the output buffer is flushed to the browser at the end of the request. When output_callback is called, it will receive the contents of the output buffer as its parameter and is expected to return a new output buffer as a result, which will be sent to the browser. If the output_callback is not a callable function, this function will return FALSE.

    Nota: In PHP 4.0.4, ob_gzhandler() was introduced to facilitate sending gz-encoded data to web browsers that support compressed web pages. ob_gzhandler() determines what type of content encoding the browser will accept and will return its output accordingly.

    Nota: Before PHP 4.3.2 this function did not return FALSE in case the passed output_callback can not be executed.

    Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order.

    ob_end_clean(), ob_end_flush(), ob_clean(), ob_flush() and ob_start() may not be called from a callback function. If you call them from callback function, the behavior is undefined. If you would like to delete the contents of a buffer, return "" (a null string) from callback function.

    Esempio 1. User defined callback function example
    Codice PHP:
    <?php

    function callback($buffer
    {
      
    // replace all the apples with oranges
      
    return (str_replace("apples""oranges"$buffer));
    }

    ob_start("callback");

    ?>

    <html>
    <body>


    It's like comparing apples to oranges.
    </body>
    </html>

    <?php

    ob_end_flush
    ();

    ?>  

    Would produce: 

    <html>
    <body>


    It's like comparing oranges to oranges.
    </body>
    </html>
    non so come altro aiutarti perchè è una cosa che non ho ancora mai incontrato!

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.