note 62778 added to function.include

From: Date: Thu, 09 Mar 2006 13:11:20 +0000
Subject: note 62778 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-105134@lists.php.net to get a copy of this message
Me encontre con un problema al hacer "include" con algunos archivos donde solo guardo variables con informacion, ya que al compilar el codigo php lee y despliega toda la informacion del file. ejemplo -- incfile.x -- $mi_var1 = "algun texto o lo que sea..."; $mi_var2 = $mi_var1."mas texto"; -- end -- -- file.php -- <? .. include incfile.x ... echo $mi_var1; ?> -- end -- En este ejemplo esperaba esta salida: -- resultado -- algun texto lo que sea -- end -- Pero desplegaba esto: -- resultado -- $mi_var1 = "algun texto o lo que sea..."; $mi_var2 = $mi_var1."mas texto"; -- end -- La manera que encontre para solucionarlo es mediante el implemento de dos lineas en el incfile.x: -- incfile.x -- <html> <? $mi_var1 = "algun texto o lo que sea..."; $mi_var2 = $mi_var1."mas texto"; ?> </html> -- end -- de esta manera el codigo sale: -- resultado -- algun texto lo que sea -- end -- ---- Server IP: 200.59.45.3 Probable Submitter: 201.252.61.77 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/note/edit/62778 Del: integrated -- http://master.php.net/note/delete/62778/integrated Del: useless -- http://master.php.net/note/delete/62778/useless Del: bad code -- http://master.php.net/note/delete/62778/bad+code Del: spam -- http://master.php.net/note/delete/62778/spam Del: non-english -- http://master.php.net/note/delete/62778/non-english Del: in docs -- http://master.php.net/note/delete/62778/in+docs Del: other reasons-- http://master.php.net/note/delete/62778 Reject -- http://master.php.net/note/reject/62778 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105134) next »