Yaf之配置和Bootstrap

2021-07-12 06:31:56 字數 1443 閱讀 8272

[common]

[product : common]

2.列印出配置資訊看一下:
<?php 

class

indexcontroller

extends

yaf_controller_abstract

}?>

3.檢視配置資訊

4.那麼怎麼加入多組配置資訊呢,比如我有兩個redis伺服器

很簡單,可以看出上面的配置檔案,裡面有乙個common組,下面列出的配置資訊列印在了瀏覽器上!那麼我們就可以再新增乙個redis的組

[common]

[redis]

;用作快取的redis伺服器

redis.cache

.host = 192.168

.254

.128

redis.cache

.port = 6379

redis.cache

.dbindex = 1

;用作儲存使用者資訊的redis伺服器

redis.user

.host = 192.168

.254

.128

redis.user

.port = 6379

redis.user

.dbindex = 12

;別忘了在這裡加上你要讀取的配置組名

//可以新增其他以_init開頭的方法

public

function

_initconfig

(yaf_dispatcher $dispatcher)

}

class

userplugin

extends

yaf_plugin_abstact

//下面就可以放入上面鉤子中的方法

}

入口檔案index.php

Yaf安裝和配置

確定系統已經安裝了gcc gcc c make automake autoconf等依賴庫 sudo apt get install gcc gcc c make automake autoconf步驟 tar zxvf yaf 2.1.18.tgz cd yaf 2.1.18 wget tar z...

yaf 安裝和開發環境配置

1.安裝的話就是phpize 然後 configure,make make install 2.新增yaf.so 到php.ini 重啟php fpm 3.nginx 配置 yaf官網給的不對,google了幾個文件,算可以了 server error page 500 502 503 504 50...

yaf配置通用函式

yaf配置通用函式 在bootstrap.php中載入 通用函式配置 public function initcommonfunctions 然後,在裡面寫通用的函式,就可以了!通用函式庫 function test 也可以引入類 通用函式配置 public function initcommonf...