| 11 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
| 226 |
liveuser |
6 |
Copyright (C) 2014~2025 MIN ZHI, CHEN
|
| 11 |
liveuser |
7 |
|
|
|
8 |
This file is part of QBPWCF.
|
|
|
9 |
|
|
|
10 |
QBPWCF is free software: you can redistribute it and/or modify
|
|
|
11 |
it under the terms of the GNU General Public License as published by
|
|
|
12 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
13 |
(at your option) any later version.
|
|
|
14 |
|
|
|
15 |
QBPWCF is distributed in the hope that it will be useful,
|
|
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
18 |
GNU General Public License for more details.
|
|
|
19 |
|
|
|
20 |
You should have received a copy of the GNU General Public License
|
|
|
21 |
along with QBPWCF. If not, see <http://www.gnu.org/licenses/>.
|
|
|
22 |
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
#使用命名空間qbpwcf
|
|
|
26 |
namespace qbpwcf;
|
|
|
27 |
|
|
|
28 |
#assets dir
|
|
|
29 |
$assetsDir="assets of config::client_xxxxxxxx";
|
|
|
30 |
|
|
|
31 |
#函式說明:
|
|
|
32 |
#查尋有使用 server 函式提供組態設定檔的服務,取得key的value.
|
|
|
33 |
#回傳結果:
|
|
|
34 |
#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
|
|
|
35 |
#$result["error"],錯誤訊息陣列.
|
|
|
36 |
#$result["function"],當前執行的函數名稱.
|
|
|
37 |
#$result["content"],結果.
|
|
|
38 |
#必填參數:
|
|
|
39 |
#$conf["server"],字串,組態服務設定服務的網址
|
|
|
40 |
$conf["server"]="https://latest.qbpwcf.org/sample/config::server.php";
|
|
|
41 |
#$conf["postName"],字串,POST變數的名稱,亦即要查尋的定義名稱.
|
|
|
42 |
$conf["postName"]="169.254.1.1";
|
|
|
43 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
44 |
$conf["fileArgu"]=__FILE__;
|
|
|
45 |
#可省略參數:
|
|
|
46 |
#$conf["cache"],字串,預設為"true",代表會啟用cache服務;反之為"false".
|
|
|
47 |
$conf["cache"]="true";
|
|
|
48 |
#$conf["clientCacheDaemonSock"],字串,提供cache服務的 unix domain socket 檔案位置,預設為套件根目錄底下的"var/config::client/clientCacheDaemon.sock";.
|
|
|
49 |
#$conf["clientCacheDaemonSock"]="";
|
|
|
50 |
#$conf["inBg"],字串,預設為"false",代表在前景執行;反之為"true"代表在背景中執行,會強制將"cache"參數設為"false".
|
|
|
51 |
#$conf["inBg"]="true";
|
|
|
52 |
#參考資料:
|
|
|
53 |
#無.
|
|
|
54 |
#備註:
|
|
|
55 |
#目前僅能跟server函式提供的服務對接.
|
|
|
56 |
$client=config::client($conf);
|
|
|
57 |
unset($conf);
|
|
|
58 |
|
|
|
59 |
#debug
|
|
|
60 |
var_dump($client);exit;
|
|
|
61 |
|
|
|
62 |
#如果執行失敗
|
|
|
63 |
if($client["status"]==="false"){
|
|
|
64 |
|
|
|
65 |
#函式說明:
|
|
|
66 |
#撰寫log
|
|
|
67 |
#回傳結果:
|
|
|
68 |
#$result["status"],狀態,"true"或"false".
|
|
|
69 |
#$result["error"],錯誤訊息陣列.
|
|
|
70 |
#$result["function"],當前函式的名稱.
|
|
|
71 |
#$result["argu"],使用的參數.
|
|
|
72 |
#必填參數:
|
|
|
73 |
#$conf["path"],字串,log檔案的路徑與名稱.
|
|
|
74 |
$conf["path"]=$logFile;
|
|
|
75 |
#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
|
|
|
76 |
$conf["content"]=$client;
|
|
|
77 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
|
|
|
78 |
$conf["fileArgu"]=__FILE__;
|
|
|
79 |
#可省略參數:
|
|
|
80 |
#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
|
|
|
81 |
#$conf["rewrite"]="false";
|
|
|
82 |
#參考資料:
|
|
|
83 |
#無.
|
|
|
84 |
#備註:
|
|
|
85 |
#無.
|
|
|
86 |
$record=logs::record($conf);
|
|
|
87 |
unset($conf);
|
| 226 |
liveuser |
88 |
|
| 11 |
liveuser |
89 |
#結束執行
|
|
|
90 |
exit(1);
|
|
|
91 |
|
|
|
92 |
}#if end
|
|
|
93 |
|
|
|
94 |
#印出 json 結果
|
| 226 |
liveuser |
95 |
echo json_encode($client["content"]);
|