国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Ubuntu > 正文

Ubuntu10.10 Zend FrameWork配置方法及helloworld顯示

2020-10-18 20:55:09
字體:
來源:轉載
供稿:網友

、大概思路

1.1

(備注:安裝Zend Framework,其附帶apache2php5)

1.2、

 

Zend Framework配置

2.1、安裝Zend Framework

ubuntu10.10的軟件中心安裝zf.

2.2、激活apacherewrite模塊

命令行輸入:sudo a2enmod rewrite

 

2.3、配置PHP5路徑

配置include_path路徑信息,修改/etc/php5/con.d目錄下的zend-framework.ini

終端輸入:sudo gedit /etc/php5/conf.d/zend-framework.ini

2.4、創建firstProject項目

終端輸入:zf create project firstProject

(其路徑默認為 Ubuntu主文件目錄下)

 

2.5、在Apache2建立firstProject項目配置文件

因為apache默認的web目錄是在/var/www下,為了能夠讓 apache自動定位到指定目錄下的web應用,這里我們在/etc/apache2/conf.d中創建一個關于firstProject的配置文件,稱為 firstProject.conf

終端輸入:sudo gedit /etc/apache2/conf.d/firstProject.conf

文件的內容是:

復制代碼
代碼如下:

<IfModule alias_module>
Alias /firstProject "/home/administrator/firstProject/public/"
<Directory "/home/administrator/firstProject/public/">
Allow from all
RewriteEngine on
RewriteBase /firstProject
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !/.(css|js|jpg|gif|png|swf|flv)$ index.php
Options FollowSymlinks MultiViews
AllowOverride All
</Directory>
</IfModule>

2.6、修改項目firstProjectpublic文件下的.htaccess

增加一行RewriteBase /firstProject

.htaccess默認是隱藏的,可按快捷鍵Ctrl+H顯示出來)

RewriteEngine On

RewriteBase /firstProject

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ index.php [NC,L]

 

2.7、啟動運行http://localhost/firstProject

 

Zend Framework顯示hello 

3.1、從終端進入firstProject文件夾內,運行zf create Controller showhello 
3.2、編寫application/controllers/ShowhelloController.php

復制代碼
代碼如下:

<?php
class ShowhelloController extends Zend_Controller_Action {
public function init() {
/* Initialize action controller here */
}
public function indexAction() {
// action body
$this->view->content = "Hello World";
$this->render ();
}
}

3.3、編寫application/views/scripts/showhello/index.phtml

復制代碼
代碼如下:



<center>View script for controller <b>Showhello </b> and script/action
name <b>index</b>
<p><font color="#FF0000">
<?=$this->content;?>
</font></p>
</center>

3.4、運行http://localhost/firstProject/showhello

四、總結

配置環境雖然是件很麻煩的事,但是只要花一些時間,總可以找到相應的解決方法。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 甘肃省| 彰武县| 万源市| 临武县| 大荔县| 宣化县| 冷水江市| 博兴县| 双城市| 平湖市| 县级市| 团风县| 余庆县| 崇义县| 大同市| 台中市| 内江市| 乌兰浩特市| 张家港市| 新乐市| 阆中市| 松潘县| 清徐县| 克什克腾旗| 禄丰县| 九寨沟县| 鲜城| 连城县| 泸水县| 聂拉木县| 崇州市| 梧州市| 宿州市| 金寨县| 都匀市| 玛纳斯县| 准格尔旗| 自贡市| 大冶市| 自贡市| 郎溪县|