国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 PHP開發(fā) Environment configuration for getting started with Zend Framework and the first Hello World example

Environment configuration for getting started with Zend Framework and the first Hello World example

Jan 05, 2017 am 10:14 AM

The examples in this article describe the environment configuration for getting started with Zend Framework and the first Hello World program. Share it with everyone for your reference, the details are as follows:

Step 1: Confirm your PHP environment:

1. Please ask PHPer to confirm whether your PHP version is above 5.2.0. If If not... please update to 5.2.0, otherwise Zend Framework seems to be unusable... I have tried it myself.

encountered such a problem... So please test it yourself... PHP source code The latest version download address is: http://www.php.net/downloads.php.

2. After your PHP environment is configured, please open the php.ini file and confirm whether the PDO extension is turned on. If not, please remove the ; number before extension=php_pdo.dll.

3. Open the httpd.conf file in the APACHE folder. Find the mod_rewrite module of apache and confirm LoadModule rewrite_module modules/mod_rewrite.so Whether to open it. If not, please remove the # sign in front of it.

4. Find the httpd.conf file. If AllowOverride is None... please be sure to change None to all. In this way, you write .htaccess like this Only the files will work.

5. Restart your APACHE server..So that our PHP environment can use Zend Framewrok.

Step 2: Get Zend Framework Source code:

1. Download the latest version of Zend Framework source code. The latest version seems to be 1.7.0 now. But it is afraid of instability. So PHPers please decide which version to use.

You can download the latest version of the source code here http://www.zendframework.com/download/latest.

Step 3: Establish the project directory:

I don’t want to say anything more ..I will show you the picture..It is the project directory of my tutorial...I have explained it above..You can create the directory in the following way..Of course, I will provide the source code for download below.

However, I suggest that friends must do it themselves... so that they can learn more... I have given the source code just for everyone's reference.

Step 4: Program description:

I won’t say much here. Because there are comments in each file. I think it won’t be too difficult. If some friends don’t understand, please leave me a message on the blog. I will follow this blog... try my best Answer your questions..Thank you..

index.php (website entrance) file and description:

<?php
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set(&#39;Asia/Shanghai&#39;);
set_include_path(&#39;.&#39; .PATH_SEPARATOR .&#39;./library&#39; .PATH_SEPARATOR .&#39;./application/models/&#39;.PATH_SEPARATOR .get_include_path());
require_once &#39;Zend/Loader.php&#39;; Zend_Loader::registerAutoload();
//設置Zend Framework 自動載入類文件
$registry = Zend_Registry::getInstance();
//設置模板顯示路徑 $view = new Zend_View();
$view->setScriptPath(&#39;./application/views/scripts/&#39;);
$registry[&#39;view&#39;] = $view;//注冊View
//設置控制器
$frontController =Zend_Controller_Front::getInstance();
$frontController->setBaseUrl(&#39;/zendframework&#39;)//設置基本路徑 ->setParam(&#39;noViewRenderer&#39;, true) ->setControllerDirectory(&#39;./application/controllers&#39;) ->throwExceptions(true) ->dispatch();

IndexController.php file and description:

<?php
class IndexController extends Zend_Controller_Action {
function init() {
$this->registry = Zend_Registry::getInstance();
$this->view = $this->registry[&#39;view&#39;];
$this->view->baseUrl = $this->_request->getBaseUrl();
}
function indexAction() {
//這里給變量賦值,在index.phtml模板里顯示
$this->view->bodyTitle = &#39;<h1>Hello World!</h1>&#39;;
echo $this->view->render(&#39;index.phtml&#39;);//顯示模版
}
}

index.phtml Template file description:

<?=$this->bodyTitle; ?>
<!-- 這里輸出控制器里Action傳過來的值:hello world -->

I hope this article will be helpful to everyone’s PHP program design based on the Zend Framework framework.

For more articles on environment configuration for getting started with Zend Framework and the first Hello World example, please pay attention to the PHP Chinese website!

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

Undress AI Tool

Undress AI Tool

Undress images for free

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.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

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)