3

我想在多个域上运行 Zend Framework。在 1 个域上,我有整个应用程序,每个域有 2 个不同的 application.ini。在另一个域上,我只复制了公用文件夹。但我似乎无法让第二个域在 index.php 中运行一些东西,希望你们能帮助我。

<?php
header("Content-type: text/html; charset=utf-8");
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../DOMAIN_WITH_APPLICATION_MAP/application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../../DOMAIN_WITH_APPLICATION_MAP/library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance ();
$loader->setFallbackAutoloader ( true );
$loader->suppressNotFoundWarnings ( false );

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application2.ini'
);
$application->bootstrap()
            ->run();
4

1 回答 1

0

您将需要更新服务器配置。如果您使用的是 apache,您将需要使用 ServerAlias,它允许您将内容从主域映射到别名域。例子:

<VirtualHost *:80>
    ServerName www.mysite.co.uk
    ServerAlias www.mysite2.co.uk www.mysite3.co.uk
</VirtualHost>
于 2013-06-04T11:15:43.543 回答