From: Onur Yalazi (onuryalazi@mersin.edu.tr)
Date: Sat 12 Jul 2003 - 02:05:47 EEST
Hasan Saral wrote:
> elimde ana.php ve include.php diye iki sayfa var. include.php baska
> bir serverde.
> include.php?mod=txt seklinde calistirirsam
> header ("Content-type: text/html; charset=utf-8");
> echo "deger1;deger2"
> komutlarini calistiriyorum.
> include.php?mod=xml seklinde calistirisam
> header ("Content-type: text/xml; charset=utf-8");
> echo "<test>deger</test>"
> komutlarini calistiriyorum.
> sorum su:
> ana.php icine include.php yi header komutu duzgun calisacak sekilde
> nasil ekleyebilirim. cunku include require fopen fpasstru bunlarin hic
> biri bana dogru deger dondurmuyor. her sey duzgun calisiyor fakat
> include.php icindeki gonderdigim header komutu islevsiz kaliyor.
> (include.php yi direkt cagirirsam hersey dogru calisiyor)
> header('location: include.php?mod=xml') komutunu onermeyin onu
> kullanmamam gerekiyor.(donen degeri <img
> source=include.php?mod=binary> seklinde kullanacagim yerler olacak
> cunku).
> Bilmem anlatabildimmi yardimlarinizi bekliyorum. Herkese iyi calismalar.
> Hasan Saral
Merhaba,
(ya da iyi geceler :) )
http://tr2.php.net/manual/en/function.include.php den al?nt?
"When a file is included, parsing drops out of PHP mode and into HTML
mode at the beginning of the target file, and resumes again at the end.
For this reason, any code inside the target file which should be
executed as PHP code must be enclosed within valid PHP start and end
tags
<http://tr2.php.net/manual/en/language.basic-syntax.php#language.basic-syntax.phpmode>."
Belki sorununuz bundan ibarettir. Eg(er sorun bundan deg(il ise
include.php içinden
"return gonderilecek header"
ve
ana.php içinden
$x = include("include.php");
header($x);
kodunu (is,inize yarayacak ise) deneyebilirsiniz.
Birde sorun include.php içinde bos,luklar olmas?ndan kaynaklanabilir.
Tabii böyle bir durumda "headers already sent" hatas? vermeli. Eg(er
sorunun bundan kaynakland?g(?n? düs,ünüyorsan?z output buffering deneyin.
Onur Yalaz?