Zend Framework教程之Bootstrap類用法概述,zendbootstrap
Jun 13, 2016 am 08:44 AMZend Framework教程之Bootstrap類用法概述,zendbootstrap
本文實(shí)例講述了Zend Framework中Bootstrap類用法。分享給大家供大家參考,具體如下:
Zend_Application_Bootstrap_Bootstrapper
Zend_Application_Bootstrap_Bootstrapper是所有引導(dǎo)類必須實(shí)現(xiàn)的基本接口?;竟δ苁怯糜谂渲?,注冊資源,引導(dǎo)(無論是單個資源或整個應(yīng)用程序),并運(yùn)行應(yīng)用程序。
接口方法:
Zend_Application_Bootstrap_Bootstrapper Interface
Method | Return Value | Parameters | Description |
---|---|---|---|
__construct( $application ) |
Void |
|
構(gòu)造方法。接受一個參數(shù),參數(shù)要求是一個Zend_Application對象,或另一個引導(dǎo)對象。 |
setOptions( array $options) |
Zend_Application_Bootstrap_Bootstrapper |
|
通常情況下, 選項(xiàng)都可以匹配映射到對應(yīng)的setter;否則,選項(xiàng)僅僅會被存儲,便于以后查找 |
getApplication() | Zend_Application?|Zend_Application_Bootstrap_Bootstrapper | N/A |
獲取application實(shí)例 |
getEnvironment() | String | N/A |
獲取environment |
getClassResources() | Array | N/A |
獲取可以可用的資源 |
bootstrap($resource = null) | Mixed |
|
如果?$resource為空,注冊所有資源.如果為字符串注冊指定的資源;如果是數(shù)組, 只注冊指定的資源. |
run() | Void | N/A |
執(zhí)行引導(dǎo). |
Zend_Application_Bootstrap_ResourceBootstrapper
Zend_Application_Bootstrap_ResourceBootstrapper是一個接口,用于引導(dǎo)類加載注冊外部資源 。 也就是說,一個或多個資源不會直接在類中定義,而是通過插件形式引入。它應(yīng)該與Zend_Application_Bootstrap_Bootstrapper結(jié)合使用; Zend_Application_Bootstrap_BootstrapAbstract實(shí)現(xiàn)了這個功能。
接口方法:
Zend_Application_Bootstrap_ResourceBootstrapper Interface
Method | Return Value | Parameters | Description |
---|---|---|---|
registerPluginResource($resource, $options = null) | Zend_Application_Bootstrap_ResourceBootstrapper |
|
用于注冊資源類,通過可選選項(xiàng)傳遞資源 |
unregisterPluginResource($resource) | Zend_Application_Bootstrap_ResourceBootstrapper |
|
刪除插件資源 |
hasPluginResource($resource) | Boolean |
|
|
getPluginResource($resource) | Zend_Application_Resource_Resource |
|
|
getPluginResourceNames() | Array | N/A |
|
setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) | Zend_Application_Bootstrap_ResourceBootstrapper |
|
|
getPluginLoader() | Zend_Loader_PluginLoader_Interface | N/A |
|
Zend_Application_Bootstrap_BootstrapAbstract
Zend_Application_Bootstrap_BootstrapAbstract是一個抽象類,它提供了一個通用的引導(dǎo)基本功能。它實(shí)現(xiàn)了Zend_Application_Bootstrap_Bootstrapper和Zend_Application_Bootstrap_ResourceBootstrapper。
Zend_Application_Bootstrap_BootstrapAbstract Methods
Method | Return Value | Parameters | Description |
---|---|---|---|
__construct($application) | Void |
|
Accepts either a?Zend_Application?or a?Zend_Application_Bootstrap_Bootstrapper?object as the sole argument. |
setOptions(array $options) | Zend_Application_Bootstrap_Bootstrapper |
|
所有選項(xiàng)都可以映射到選項(xiàng)指定的setter??, 否則,該選項(xiàng)將只是被存儲供以后查找 例如,如果在擴(kuò)展類中定義一個setFoo() 方法,可以通過foo選項(xiàng)傳遞值 |
getOptions() | Array | N/A |
? |
hasOption($key) | Boolean |
|
? |
getOption($key) | Mixed |
|
不存在返回?NULL?? |
setApplication(Zend_Application | Zend_Application_Bootstrap_Bootstrapper $application) | Zend_Application_Bootstrap_BootstrapAbstract |
|
? |
getApplication() | Zend_Application?|Zend_Application_Bootstrap_Bootstrapper | N/A |
? |
getEnvironment() | String | N/A |
? |
getClassResources() | Array | N/A |
? |
getContainer() | Object | N/A |
獲取存儲資源的容器。如果沒有容器,可以通過Zend_Registry注冊,然后返回一個Zend_Registry實(shí)例。 |
setContainer($container) | Zend_Application_Bootstrap_BootstrapAbstract |
|
|
hasResource($name) | Boolean |
|
? |
getResource($name) | Mixed |
|
? |
bootstrap($resource = null) | Mixed |
|
如果?$resource為空,注冊所有資源.如果為字符串注冊指定的資源;如果是數(shù)組, 只注冊指定的資源. |
run() | Void | N/A |
|
__call($method, $args) | Mixed |
|
為了方便可以用'bootstrap |
Zend_Application_Bootstrap_Bootstrap
Zend_Application_Bootstrap_Bootstrap是Zend_Application_Bootstrap_BootstrapAbstract具體實(shí)現(xiàn)。它的主要功能是,注冊資源,然后運(yùn)行 run() 方法。
在大多數(shù)情況下,你可以根據(jù)自己的引導(dǎo)需求繼承這個類或直接使用這個類,并來注冊資源插件。
啟用 Application 自動加載功能
此外,該引導(dǎo)的實(shí)現(xiàn)提供了自動加載指定“命名空間”或指定資源類的前綴的功能
本質(zhì)上,它實(shí)例化一個Zend_Application_Module_Autoloader的對象,參數(shù)為命名空間和引導(dǎo)類的目錄。可以開啟這個功能,通過 “appnamespace”配置選項(xiàng)設(shè)置命名空間。
As an INI example:
appnamespace = "Application"
Or in XML:
<appnamespace>Application</appnamespace>
默認(rèn)情況下,Zend_Tool提供“Application”命名空間。
或者,可以在bootstrap類中通過$_appNamespace屬性指定命名空間。
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected $_appNamespace = 'Application'; }
更多關(guān)于zend相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Zend FrameWork框架入門教程》、《php優(yōu)秀開發(fā)框架總結(jié)》、《Yii框架入門及常用技巧總結(jié)》、《ThinkPHP入門教程》、《php面向?qū)ο蟪绦蛟O(shè)計入門教程》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》
希望本文所述對大家PHP程序設(shè)計有所幫助。
您可能感興趣的文章:
- Zend Framework自定義Helper類相關(guān)注意事項(xiàng)總結(jié)
- Zend Framework教程之資源(Resources)用法實(shí)例詳解
- Zend Framework教程之Application和Bootstrap用法詳解
- Zend Framework教程之配置文件application.ini解析
- Zend Framework教程之Loader以及PluginLoader用法詳解
- Zend Framework教程之Autoloading用法詳解
- Zend Framework教程之Resource Autoloading用法實(shí)例
- Zend Framework教程之MVC框架的Controller用法分析
- Zend Framework教程之路由功能Zend_Controller_Router詳解
- Zend Framework教程之Zend_Controller_Plugin插件用法詳解
- Zend Framework教程之響應(yīng)對象的封裝Zend_Controller_Response實(shí)例詳解
- Zend Framework教程之動作的基類Zend_Controller_Action詳解
- Zend Framework教程之前端控制器Zend_Controller_Front用法詳解
- Zend Framework教程之Application用法實(shí)例詳解

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

To verify dates in Bootstrap, follow these steps: Introduce the required scripts and styles; initialize the date selector component; set the data-bv-date attribute to enable verification; configure verification rules (such as date formats, error messages, etc.); integrate the Bootstrap verification framework and automatically verify date input when form is submitted.

How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

Answer: You can use the date picker component of Bootstrap to view dates in the page. Steps: Introduce the Bootstrap framework. Create a date selector input box in HTML. Bootstrap will automatically add styles to the selector. Use JavaScript to get the selected date.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

Web development design is a promising career field. However, this industry also faces many challenges. As more businesses and brands turn to the online marketplace, web developers have the opportunity to demonstrate their skills and succeed in their careers. However, as demand for web development continues to grow, the number of developers is also increasing, resulting in increasingly fierce competition. But it’s exciting that if you have the talent and will, you can always find new ways to create unique designs and ideas. As a web developer, you may need to keep looking for new tools and resources. These new tools and resources not only make your job more convenient, but also improve the quality of your work, thus helping you win more business and customers. The trends of web development are constantly changing.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text
