[Codeigniter-users] ヘッダー制御

Back to archive index

Kenji kenji****@club*****
2009年 6月 6日 (土) 23:26:15 JST


Kenji です。


echo で出力しているためです。

CodeIgniter の Outputクラスから出力しない場合は、
$this->output->set_header() は無効です。

set_header() は、見てのとおり、Outputクラスのメソッドですから。

簡単に言えば、echo で出力するというこは、CodeIgniter の
枠外になるということです。


// Kenji


On Sat, 06 Jun 2009 12:29:14 +0900
ikari****@ecoin***** wrote:

> お世話になります
> 碇です
> 
> テストコード1
> class Test extends Controller{
> function __construct(){
> 	parent::Controller();
> 	$this->output->set_header("Content-Type: text/xml");
> 	$this->output->set_header("Cache-Control: no-cache");
> 	$this->output->set_header("Pragma: no-cache");
> 	$this->output->set_header("Expires: 0");
> }
> function index(){
> 	echo '<?xml version="1.0" encoding="utf-8" ?>';
> 	echo '<a>a</a>';
> }
> }	
> 
> テストコード2
> class Test extends Controller{
> function __construct(){
> 	parent::Controller();
> }
> 
> function index(){
> 	$this->output->set_header("Content-Type: text/xml");
> 	$this->output->set_header("Cache-Control: no-cache");
> 	$this->output->set_header("Pragma: no-cache");
> 	$this->output->set_header("Expires: 0");
> 	echo '<?xml version="1.0" encoding="utf-8" ?>';
> 	echo '<a>a</a>';
> }
> }
> 
> }	
> 
> このようにしてみましたが動作していないようです
> 以上よろしくお願いします
> 
> On Sat, 6 Jun 2009 07:38:31 +0900
> Kenji <kenji****@club*****> 様wrote:
> 
> > Kenji です。
> > 
> > 
> > On Sat, 06 Jun 2009 00:38:57 +0900
> > ikari****@ecoin***** wrote:
> > 
> > > お世話になります
> > > 碇です
> > > 
> > > キャッシュコントロールをしたいためHTTPヘッダーを制御したいです
> > > マニュアルを見る限り
> > > $this->output->set_header("Cache-Control: no-cache");
> > > $this->output->set_header("Pragma: no-cache");
> > > $this->output->set_header("Expires: 0");
> > > 
> > > このような記述ができるようで
> > > 
> > > __construct()内やindex()でよんでみたのですが
> > > Live HTTP headers
> > > で見る限りはヘッダにセットされていないようです
> > > 
> > > どのようにしたらヘッダを制御できるでしょうか?
> > 
> > それで動作するはずです。
> > 
> > 動作しないサンプルコードがあれば、動作しない理由が
> > わかるかも知れません。
> > 
> > 
> > // Kenji
> > 
> > _______________________________________________
> > Codeigniter-users mailing list
> > Codei****@lists*****
> > http://lists.sourceforge.jp/mailman/listinfo/codeigniter-users
> 
> -- 
> 碇 永志
>  <ikari****@ecoin*****>
> 
> _______________________________________________
> Codeigniter-users mailing list
> Codei****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/codeigniter-users




Codeigniter-users メーリングリストの案内
Back to archive index