Home > Backend Development > PHP Tutorial > Introduction to the method of automatically loading classes in zend Framework

Introduction to the method of automatically loading classes in zend Framework

WBOY
Release: 2016-07-25 08:58:14
Original
807 people have browsed it
This article introduces the calling method of automatically loading classes in the zend framework framework for your reference.

1. Automatic loading of classes in modules

<?php
$loader = new Zend_Application_Module_Autoloader(array( //模块内容自动加载类
'namespace' => 'Blog',//命名空间定义 即方法的开头为Blog_
'basePath' => APPLICATION_PATH . '/modules/blog',//模块位置
));
?>
Copy after login

2, automatic loading

<?php
require_once 'Zend/Loader/Autoloader.php';
$loader =Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Application_');
//注意,看下载入的目录地址是否已被载入
?>
Copy after login

Let’s introduce the above two types, I hope it will be helpful to everyone.



source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template