Home Backend Development PHP Tutorial php之ZendFramewor篇(2)zf+samrty index.php 配置

php之ZendFramewor篇(2)zf+samrty index.php 配置

Jun 13, 2016 pm 01:20 PM
application gt path smarty zend

php之ZendFramewor篇(二)zf+samrty index.php 配置

	<?php error_reporting (E_ALL & ~E_DEPRECATED & ~E_NOTICE);
 
date_default_timezone_set ( 'Asia/Shanghai' );

define('ROOT_PATH',($ROOT_PATH =dirname(__FILE__))? $ROOT_PATH : '..');

defined ( 'APPLICATION_PATH' ) || define ( 'APPLICATION_PATH', realpath ( dirname ( __FILE__ ) . '/../application' ) );

defined ( 'APPLICATION_ENV' ) || define ( 'APPLICATION_ENV', (getenv ( 'APPLICATION_ENV' ) ? getenv ( 'APPLICATION_ENV' ) : 'production') );

set_include_path ( implode ( PATH_SEPARATOR, array (realpath ( APPLICATION_PATH . '/../library' ), get_include_path () ) ) );
set_include_path ( '.' . PATH_SEPARATOR . '../application/controllers/' . '../application/models/' . '../application/dao/' . PATH_SEPARATOR . get_include_path () );

require_once "Zend/Loader/Autoloader.php";
Zend_Loader_Autoloader::getInstance ()->setFallbackAutoloader ( true );
$registry = Zend_Registry::getInstance ();

$config = new Zend_Config_Ini ( '../application/configs/application.ini', null, true );
Zend_Registry::set ( 'config', $config );
$dbAdapter = Zend_Db::factory ( $config->database->db->adapter, $config->database->db->config->toArray () );
$dbAdapter->query ( 'SET names utf8' );
Zend_Db_Table::setDefaultAdapter ( $dbAdapter );
Zend_Registry::set ( 'db', $dbAdapter );

require_once 'Zend/Log.php';
require_once 'Zend/Log/Writer/Stream.php';
$logger = new Zend_Log ( new Zend_Log_Writer_Stream ( '.' . $config->log->logger->path, 'a+' ) );
Zend_Registry::set ( 'logger', $logger );

$view = new Zend_View ();
$view->setScriptPath ( './templates/' );
$view->setHelperPath('./templates/helpers', 'Zend_View_Helper');
$registry ['view'] = $view;

include_once ("../library/Smarty/Smarty.class.php");
$smarty = new Smarty ();
$smarty->caching = false;
$smarty->template_dir = "./templates/";
$smarty->compile_dir = "./data/smarty/";
$smarty->cache_dir = "./data/smarty/cache_c/";
//$smarty->left_delimiter = "right_delimiter = "}>";
$registry = Zend_Registry::getInstance ();
$registry->set ( 'smarty', $smarty );

$front = Zend_Controller_Front::getInstance ();
$front->setBaseUrl ( '/' );
$front->setParam ( 'useDefaultControllerAlways', true );
$front->setParam ( 'noViewRenderer', true );
$front->setControllerDirectory ( '../application/controllers' );
$front->throwExceptions ( true );
Zend_Session::start();
require_once 'Zend/Application.php';
$application = new Zend_Application ( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' );
$application->bootstrap ()->run ();

?>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Steps to set the PATH environment variable of the Linux system Steps to set the PATH environment variable of the Linux system Feb 18, 2024 pm 05:40 PM

How to set the PATH environment variable in Linux systems In Linux systems, the PATH environment variable is used to specify the path where the system searches for executable files on the command line. Correctly setting the PATH environment variable allows us to execute system commands and custom commands at any location. This article will introduce how to set the PATH environment variable in a Linux system and provide detailed code examples. View the current PATH environment variable. Execute the following command in the terminal to view the current PATH environment variable: echo$P

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

What is the principle of python WSGI Application? What is the principle of python WSGI Application? May 19, 2023 pm 01:25 PM

The python environment this article relies on is: What is WSGI? WSGI is also called the web server universal gateway interface, and its full name is webservergatewayinterface. It defines a standard for how web servers and web applications should communicate and handle http requests and responses in Python. Note that it is just a protocol, or a specification or standard. You don’t have to follow this standard. Just like the web server we wrote in the previous article. WSGI is also divided into applications and server gateways. Among them, the well-known Flask belongs to applications, and uWSGI and wsgiref belong to server gateways. Personal feeling, WSG

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

How to set the path environment variable How to set the path environment variable Sep 04, 2023 am 11:53 AM

Method to set the path environment variable: 1. Windows system, open "System Properties", click the "Properties" option, click "Advanced System Settings", in the "System Properties" window, select the "Advanced" tab, and then click "Environment Variables" " button, find and click "Path" to edit and save; 2. For Linux systems, open the terminal, open your bash configuration file, add "export PATH=$PATH: file path" at the end of the file and save it; 3. For MacOS system, the operation is the same as above.

How to use ACL (Access Control List) for permission control in Zend Framework How to use ACL (Access Control List) for permission control in Zend Framework Jul 29, 2023 am 09:24 AM

How to use ACL (AccessControlList) for permission control in Zend Framework Introduction: In a web application, permission control is a crucial function. It ensures that users can only access the pages and features they are authorized to access and prevents unauthorized access. The Zend framework provides a convenient way to implement permission control, using the ACL (AccessControlList) component. This article will introduce how to use ACL in Zend Framework

PHP Implementation Framework: Zend Framework Getting Started Tutorial PHP Implementation Framework: Zend Framework Getting Started Tutorial Jun 19, 2023 am 08:09 AM

PHP implementation framework: ZendFramework introductory tutorial ZendFramework is an open source website framework developed by PHP and is currently maintained by ZendTechnologies. ZendFramework adopts the MVC design pattern and provides a series of reusable code libraries to serve the implementation of Web2.0 applications and Web Serve. ZendFramework is very popular and respected by PHP developers and has a wide range of

See all articles