Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework] Redirector
nexis
post
Post #1





Grupa: Zarejestrowani
Postów: 1 012
Pomógł: 109
Dołączył: 26.09.2003
Skąd: nexis.pl

Ostrzeżenie: (0%)
-----


Może ktoś wyjaśni mi dziwne zachowanie poniższego kodu:

  1. <?php
  2. class SampleController extends Zend_Controller_Action
  3. {
  4.   function indexAction()
  5.   {
  6.      $this->_helper->viewRenderer->setNoRender();
  7.      $this->_helper->redirector('sample');
  8.   }
  9.   function sampleAction()
  10.   {
  11.      $this->_helper->viewRenderer->setNoRender();
  12.      exit("I'm the sample action!");
  13.   }
  14. }
  15. ?>


który generuje błąd
Kod
500 Internal Error:
The server encountered an internal error and could not complete your request.
zamiast prawidłowo przekierować do funkcji sampleAction. Co ciekawe, po zwróceniu jakiegokolwiek znaku przed wywołaniem $this->_helper->redirector('sample');, przekierowanie działa prawidłowo.

  1. <?php
  2. class SampleController extends Zend_Controller_Action
  3. {
  4.   function indexAction()
  5.   {
  6.      $this->_helper->viewRenderer->setNoRender();
  7.      echo PHP_EOL;
  8.      $this->_helper->redirector('sample');
  9.   }
  10.   function sampleAction()
  11.   {
  12.      $this->_helper->viewRenderer->setNoRender();
  13.      exit("I'm the sample action!");
  14.   }
  15. }
  16. ?>


Ten post edytował nexis 27.10.2008, 16:36:38


--------------------
Zend Certified Engineer

Kliknij POMÓGŁ jeśli moja odpowiedź okazała się użyteczna!
Go to the top of the page
+Quote Post
luki100011
post
Post #2





Grupa: Zarejestrowani
Postów: 243
Pomógł: 20
Dołączył: 20.04.2004
Skąd: Wielkopolska

Ostrzeżenie: (0%)
-----


Mi pomogło to:
Kod
$this->_helper->Redirector->setUseAbsoluteUri(TRUE);


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 19:09