PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Re: [PHP] set
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: [PHP] set

Réponse
 
LinkBack Outils de la discussion
Vieux 12/03/2008, 14h53   #1
Jean-Christophe Roux
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] set

> <body>
>
> <?php set('test', 45, time()+(60*60*24*7)); ?>


from the doc:
" are part of the HTTP header, so set() must be called before any output is sent to the browser. This is the same limitation that header() has."
http://ca.php.net/


----- Original Message ----
From: Tim Daff <timdaff@gmail.com>
To: php-general@lists.php.net
Sent: Wednesday, March 12, 2008 8:48:59 AM
Subject: [php] set

Hi,

I am learning PHP, I am trying to set a simple :

<html>
<head>
<title></title>
</head>
<body>

<?php set('test', 45, time()+(60*60*24*7)); ?>

</body>
</html>

Firefox is returning this error:

Warning: Cannot modify header information - headers already sent by
(output started at /Users/Daff/Sites/php_sandbox/.php:7) in /
Users/Daff/Sites/php_sandbox/.php on line 7

I have googled this and can't find out what I am doing wrong. Any
you could give me would be much appreciated.

Tim





__________________________________________________ __________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

  Réponse avec citation
Vieux 12/03/2008, 14h59   #2
Shiplu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] set

Even you cant put a space before <?php tag.

the following code will throw the same error.
| <?php
| set();
| ?>
Because I prepend a space for each line

But this will be okay
|<?php
| set();
| ?>

This is a very common mistake and very very hard to find.


On Wed, Mar 12, 2008 at 7:53 AM, Jean-Christophe Roux <jcxxr@yahoo.com>
wrote:

> > <body>
> >
> > <?php set('test', 45, time()+(60*60*24*7)); ?>

>
> from the doc:
> " are part of the HTTP header, so set() must be called
> before any output is sent to the browser. This is the same limitation
> that header() has."
> http://ca.php.net/
>
>
> ----- Original Message ----
> From: Tim Daff <timdaff@gmail.com>
> To: php-general@lists.php.net
> Sent: Wednesday, March 12, 2008 8:48:59 AM
> Subject: [php] set
>
> Hi,
>
> I am learning PHP, I am trying to set a simple :
>
> <html>
> <head>
> <title></title>
> </head>
> <body>
>
> <?php set('test', 45, time()+(60*60*24*7)); ?>
>
> </body>
> </html>
>
> Firefox is returning this error:
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /Users/Daff/Sites/php_sandbox/.php:7) in /
> Users/Daff/Sites/php_sandbox/.php on line 7
>
> I have googled this and can't find out what I am doing wrong. Any
> you could give me would be much appreciated.
>
> Tim
>
>
>
>
>
>
> __________________________________________________ __________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h35.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 2,07461 seconds with 10 queries