| 11 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
|
|
6 |
Copyright (C) 2014~2025 Min-Jhin,Chen
|
|
|
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 cmd::getArgu_20241204-1";
|
|
|
30 |
|
|
|
31 |
#get test data
|
|
|
32 |
$_GET["gn"]="gv";
|
|
|
33 |
|
|
|
34 |
#post test data
|
|
|
35 |
$_POST["pn"]="pv";
|
|
|
36 |
|
|
|
37 |
#函式說明:
|
|
|
38 |
#抓取命令列的參數.
|
|
|
39 |
#回傳結果:
|
|
|
40 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
41 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
42 |
#$result["function"],當前執行的函式名稱.
|
|
|
43 |
#$result["argu"],使用的參數陣列.
|
|
|
44 |
#$result["content"],要回傳的參數陣列.
|
|
|
45 |
#$result["count"],參數的數量.
|
|
|
46 |
#$result["_GET"],收到的 HTTP GET 參數陣列.
|
|
|
47 |
#$result["_POST"],收到的 HTTP POST 參數陣列.
|
|
|
48 |
#必填參數:
|
|
|
49 |
#無
|
|
|
50 |
#可省略參數:
|
|
|
51 |
#$conf["echo"],字串,"true"代表要將抓到的參數一個個印出來,"false"代表用回傳的方式,預設為"false".
|
|
|
52 |
#$conf["echo"]="false";
|
|
|
53 |
#$conf["httpGetToArgu"],字串,"true"代表要將 http get 參數變成參數來取得,像是 $_GET["p1"] 會變成 $result["content"]["p1"] 回傳,預設為"false"代表不使用.
|
|
|
54 |
$conf["httpGetToArgu"]="true";
|
|
|
55 |
#$conf["httpPostToArgu"],字串,"true"代表要將 http post 參數變成參數來取得,像是 $_POST["p1"] 會變成 $result["content"]["p1"] 回傳,預設為"false"代表不使用.
|
|
|
56 |
$conf["httpPostToArgu"]="true";
|
|
|
57 |
#參考資料:
|
|
|
58 |
#無.
|
|
|
59 |
#備註:
|
|
|
60 |
#無.
|
|
|
61 |
$getArgu=cmd::getArgu($conf);
|
|
|
62 |
unset($conf);
|
|
|
63 |
|
|
|
64 |
#如果執行失敗
|
|
|
65 |
if($getArgu["status"]==="false"){
|
|
|
66 |
|
|
|
67 |
#函式說明:
|
|
|
68 |
#撰寫log
|
|
|
69 |
#回傳結果:
|
|
|
70 |
#$result["status"],狀態,"true"或"false".
|
|
|
71 |
#$result["error"],錯誤訊息陣列.
|
|
|
72 |
#$result["function"],當前函式的名稱.
|
|
|
73 |
#$result["argu"],使用的參數.
|
|
|
74 |
#必填參數:
|
|
|
75 |
#$conf["path"],字串,log檔案的路徑與名稱.
|
|
|
76 |
$conf["path"]=$logFile;
|
|
|
77 |
#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
|
|
|
78 |
$conf["content"]=$getArgu;
|
|
|
79 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
|
|
|
80 |
$conf["fileArgu"]=__FILE__;
|
|
|
81 |
#可省略參數:
|
|
|
82 |
#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
|
|
|
83 |
#$conf["rewrite"]="false";
|
|
|
84 |
#參考資料:
|
|
|
85 |
#無.
|
|
|
86 |
#備註:
|
|
|
87 |
#無.
|
|
|
88 |
$record=logs::record($conf);
|
|
|
89 |
unset($conf);
|
|
|
90 |
|
|
|
91 |
#如果寫log失敗
|
|
|
92 |
if($record["status"]==="false"){
|
|
|
93 |
|
|
|
94 |
#印出結果
|
|
|
95 |
var_dump($record);
|
|
|
96 |
|
|
|
97 |
}#if end
|
|
|
98 |
|
|
|
99 |
#結束執行,回傳錯誤代碼1
|
|
|
100 |
exit(1);
|
|
|
101 |
|
|
|
102 |
}#if end
|
|
|
103 |
|
|
|
104 |
#顯示結果
|
|
|
105 |
var_dump($getArgu);
|