Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal, estou tentando criar meu primeiro HelloWorld utilizando o Zend Framework.
Estou estudando o livro Zend em Ação e no segundo capítulo tem este exemplo.
Porém dá o seguinte erro:
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in C:\wamp\www\ZF_EmAcao\Cap2\library\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 C:\wamp\www\ZF_EmAcao\Cap2\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 C:\wamp\www\ZF_EmAcao\Cap2\public\index.php(25): Zend_Controller_Front->dispatch() #2 {main} thrown in C:\wamp\www\ZF_EmAcao\Cap2\library\Zend\Controller\Dispatcher\Standard.php on line 242
O que eu faço?
Por favor confiram minha aplicação:
Desde já agradeço os esforços. http://forum.imasters.com.br/public/style_emoticons/default/grin.gif
Estrutura dos diretórios:
/applications/core/interface/imageproxy/imageproxy.php?img=http://q7uvpw.bay.livefilestore.com/y1pzARPK7kPRyO-nihdpkBcJjZCDTZVIeGK8CO4DLDABpmQC5Am3uBhbfwR3lshYoS8YGRsMV2IJD7DPANhQiTfewOHMQ-McChk/Pastas.JPG&key=f326755c72f1f36603f4751319bd0f6ba05676950822a7073f3fb260f3700205" alt="Imagem Postada" />
public/.htaccess:
<?php
// Configura o ambiente
error_reporting(E_ALL|E_STRICT); // remover esta linha ao colocar em um servidor online
ini_set('display_erros', true); // idem
date_default_timezone_set('Brazil/East'); // http://www.php.net/manual/en/timezones.php
// Configura o caminho
$rootDir = dirname(dirname(__FILE__));
set_include_path($rootDir . '/library' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Debug');
Zend_Loader::loadClass('Zend_Controller_Front');
// Obtém a instância de Zend_Controller_Front
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory('../application/controllers');
// Executa
$frontController->dispatch();
application/controllers/indexController.php
<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$this->view->assign('title', 'Hello World');
}
}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>
<?php echo $this->escape($this->title); ?> <!--Converte caracteres especiais em representações de entidade HTML-->
</title>
</head>
<body>
<h1>
<?php echo $this->escape($this->title);?>
</h1>
</body>
</html>Carregando comentários...