我需要一些帮助才能理解错误。
我从昨天开始就遇到了这个问题。因为我将我的phtml文件重新编码为utf-8(没有BOM),内部页面的链接不再起作用了。
她是我的index.php(root)
<?php
ob_start();
define('PATH', "./");
define('APPLICATION_PATH', realpath(dirname(__FILE__) . 'application/'));
define('SITE_PATH', realpath(dirname(__FILE__) . '/application/'));
define('APP_PATH', realpath(dirname(__FILE__)) . '/application/');
set_include_path(APPLICATION_PATH . 'library' . PATH_SEPARATOR . get_include_path());
set_include_path(APPLICATION_PATH . 'application' . PATH_SEPARATOR . get_include_path());
set_include_path(APPLICATION_PATH . 'application/controllers' . PATH_SEPARATOR . get_include_path());
set_include_path(APPLICATION_PATH . 'application/models/' . PATH_SEPARATOR . get_include_path());
set_include_path(APPLICATION_PATH . '' . PATH_SEPARATOR . get_include_path());
$errMsg = array();
$succMsg = array();
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
Zend_Session::start();
$mySession = new Zend_Session_Namespace('default');
try {
require 'application/Bootstrap.php';
} catch (Exception $exception) {
echo '<html><body><center>'
. 'An exception occured while bootstrapping the application.';
if (defined('APPLICATION_ENVIRONMENT') && APPLICATION_ENVIRONMENT != 'production') {
echo '<br /><br />' . $exception->getMessage() . '<br />'
. '<div align="left">Stack Trace:'
. '<pre>' . $exception->getTraceAsString() . '</pre></div>';
}
echo '</center></body></html>';
exit(1);
}
// DISPATCH: Dispatch the request using the front controller.
// The front controller is a singleton, and should be setup by now. We
// will grab an instance and dispatch it, which dispatches your
// application.
/* $fcontroller=Zend_Controller_Front::getInstance() ;
$router = $fcontroller->getRouter();$appRoutes=array();
$appRoutes['varun']= new Zend_Controller_Router_Route('/varun',array('module'=> 'default','controller' => 'index','action' => 'support'));
foreach($appRoutes as $key=>$cRouter){
$router->addRoute( $key, $cRouter );
}
*/
$mySession = new Zend_Session_Namespace('default');
Zend_Controller_Front::getInstance()->dispatch();
ob_flush();
这是我的.htaccess
AddHandler x-mapp-php5.5 .php .phtml
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
这是我的application.ini
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
database.adapter = "PDO_MYSQL"
database.params.dbname = "dbname"
database.params.host = "host.com"
database.params.username = "username"
database.params.password = "password"
database.isDefaultTableAdapter = true
database.params.charset = UTF8
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
bootstrap.php中
<?php
// APPLICATION CONSTANTS - Set the constants to use in this application.
// These constants are accessible throughout the application, even in ini
// files. We optionally set APPLICATION_PATH here in case our entry point
// isn't index.php (e.g., if required from our test suite or a script).
defined('APPLICATION_PATH') or define('APPLICATION_PATH', dirname(__FILE__));
require_once(APPLICATION_PATH.'utils/TeeImageUtils.php');
include_once(APPLICATION_PATH.'application/configs/config.inc.php');
//include_once(APPLICATION_PATH.'includes/config.php');
//include_once(APPLICATION_PATH.'paypal_pro.inc.php');
include_once(APPLICATION_PATH.'application/configs/general.php');
//include_once(APPLICATION_PATH.'application/configs/messages.php');
//include_once(APPLICATION_PATH.'facebook.php');
defined('APPLICATION_ENVIRONMENT') or define('APPLICATION_ENVIRONMENT','development');
ini_set('display_errors','on');
//error_reporting(E_ALL);
//error_reporting(0);
// FRONT CONTROLLER - Get the front controller.
// The Zend_Front_Controller class implements the Singleton pattern, which is a
// design pattern used to ensure there is only one instance of
// Zend_Front_Controller created on each request.
$frontController = Zend_Controller_Front::getInstance();
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
//Zend_Controller_Front::run('../application/controllers');
//echo "<pre>";
//print_r($frontController); die;
// CONTROLLER DIRECTORY SETUP - Point the front controller to your action
// controller directory.
$frontController->setControllerDirectory(APPLICATION_PATH .'application/controllers');
// APPLICATION ENVIRONMENT - Set the current environment
// Set a variable in the front controller indicating the current environment --
// commonly one of development, staging, testing, production, but wholly
// dependent on your organization and site's needs.
$frontController->setParam('env', APPLICATION_ENVIRONMENT);
// LAYOUT SETUP - Setup the layout component
// The Zend_Layout component implements a composite (or two-step-view) pattern
// In this call we are telling the component where to find the layouts scripts.
Zend_Layout::startMvc(APPLICATION_PATH . 'application/layouts/scripts', false,"layout");
// VIEW SETUP - Initialize properties of the view object
// The Zend_View component is used for rendering views. Here, we grab a "global"
// view instance from the layout object, and specify the doctype we wish to
// use -- in this case, XHTML1 Strict.
//$view = Zend_Layout::getMvcInstance()->getView();
//$view->setEncoding('UTF-8');
//$view->doctype('XHTML1_STRICT');
// Add helpers prefixed with Helper in helpers/
Zend_Controller_Action_HelperBroker::addPath('application/helpers/','Zend_Controller_Action_Helper_');
//$value = Zend_Controller_Action_HelperBroker::getStaticHelper('Myhelper')->displaythis();
//$value = Zend_Controller_Action_HelperBroker::getStaticHelper('Myhelper')->liscenceInfo();
// CONFIGURATION - Setup the configuration object
// The Zend_Config_Ini component will parse the ini file, and resolve all of
// the values for the given section. Here we will be using the section name
// that corresponds to the APP's Environment
$configuration = new Zend_Config_Ini(APPLICATION_PATH .'application/configs/application.ini','development');
// DATABASE ADAPTER - Setup the database adapter
// Zend_Db implements a factory interface that allows developers to pass in an
// adapter name and some parameters that will create an appropriate database
// adapter object. In this instance, we will be using the values found in the
// "database" section of the configuration obj.
$dbAdapter = Zend_Db::factory($configuration->database);
// DATABASE TABLE SETUP - Setup the Database Table Adapter
// Since our application will be utilizing the Zend_Db_Table component, we need
// to give it a default adapter that all table objects will be able to utilize
// when sending queries to the db.
$dbAdapter->query("SET NAMES 'utf8'");
Zend_Db_Table_Abstract::setDefaultAdapter($dbAdapter);
// REGISTRY - setup the application registry
// An application registry allows the application to store application
// necessary objects into a safe and consistent (non global) place for future
// retrieval. This allows the application to ensure that regardless of what
// happends in the global scope, the registry will contain the objects it
// needs.
$registry = Zend_Registry::getInstance();
$registry->configuration = $configuration;
$registry->dbAdapter = $dbAdapter;
//$helper = new Zend_Controller_Action_Helper_MWWMaster;
//$helper->preDispatch();
//Zend_Controller_Action_HelperBroker::addHelper('MWWMaster');
//$hb = new Zend_Controller_Action_HelperBroker;
//$hb->getHelper('MWWMaster');
//$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('MWWMaster');
//$viewRenderer->setView($view);
// CLEANUP - remove items from global scope
// This will clear all our local boostrap variables from the global scope of
// this script (and any scripts that called bootstrap). This will enforce
// object retrieval through the Applications's Registry
unset($frontController, $view, $configuration, $dbAdapter, $registry);
这似乎是某种.htaccess重定向问题,但我不明白的是重定向在我的管理文件夹中表现完美。
答案 0 :(得分:0)
尝试将&#34; RewriteEngine添加到您的htaccess&#34;:
RewriteBase /clients/donqui/