| 1 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
| 224 |
liveuser |
6 |
Copyright (C) 2014~2025 MIN ZHI, CHEN
|
| 1 |
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 |
#初始化輸出
|
|
|
29 |
$output=array();
|
|
|
30 |
|
|
|
31 |
#取得 lib path
|
| 97 |
liveuser |
32 |
exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../../../usr/bin/libexec/folderOfUsrLib.php"),$output,$status);
|
| 1 |
liveuser |
33 |
|
|
|
34 |
#如果執行失敗
|
|
|
35 |
if($status!==0){
|
|
|
36 |
|
|
|
37 |
#debug
|
|
|
38 |
var_dump(__LINE__,$output);
|
|
|
39 |
|
|
|
40 |
#結束執行,回傳shell 1.
|
|
|
41 |
exit(1);
|
|
|
42 |
|
|
|
43 |
}#if end
|
|
|
44 |
|
|
|
45 |
#儲存lib path
|
|
|
46 |
$folderOfUsrLib=$output[0];
|
|
|
47 |
|
|
|
48 |
#初始化輸出
|
|
|
49 |
$output=array();
|
|
|
50 |
|
|
|
51 |
#以該檔案的實際位置的 lib path 為 include path 首位
|
| 97 |
liveuser |
52 |
exec("cd ".pathinfo(__FILE__)["dirname"]."/../../../../usr/".$folderOfUsrLib."/qbpwcf;pwd;",$output,$status);
|
| 1 |
liveuser |
53 |
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
|
|
|
54 |
|
|
|
55 |
#匯入套件
|
|
|
56 |
require_once("allInOne.php");
|
|
|
57 |
|
|
|
58 |
#函式說明:
|
|
|
59 |
#將字串特定關鍵字與其後面的內容剔除
|
|
|
60 |
#回傳結果:
|
|
|
61 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
62 |
#$result["error"],錯誤訊息陣列.
|
|
|
63 |
#$result["warning"],警告訊息鎮列.
|
|
|
64 |
#$result["founded"],有無找到定字串"true"代表有,"false"代表沒有.
|
|
|
65 |
#$result["function"],當前執行的函數名稱.
|
|
|
66 |
#$result["oriStr"],要處理的原始字串內容.
|
|
|
67 |
#$result["content"],處理好的的字串內容.
|
|
|
68 |
#$result["argu"],使用的參數.
|
|
|
69 |
#必填參數:
|
|
|
70 |
#$conf["stringIn"],字串,要處理的字串.
|
|
|
71 |
$conf["stringProcess::delStrAfterKeyWord"]["stringIn"]="How are you?";
|
|
|
72 |
#$conf["keyWord"],字串,特定字串.
|
|
|
73 |
$conf["stringProcess::delStrAfterKeyWord"]["keyWord"]=" ";
|
|
|
74 |
#可省略參數:
|
|
|
75 |
#$conf["deleteLastRepeatedOne"],字串,預設為"false";若為"true"則代表連續遇到同 $conf["keyWord"] 的內容,要將移除內容的起點往後移動到為後一個 $conf["keyWord"].
|
|
|
76 |
#$conf["deleteLastRepeatedOne"]="";
|
|
|
77 |
#參考資料:
|
|
|
78 |
#無.
|
|
|
79 |
#備註:
|
|
|
80 |
#無.
|
|
|
81 |
$delStrAfterKeyWord=stringProcess::delStrAfterKeyWord($conf["stringProcess::delStrAfterKeyWord"]);
|
|
|
82 |
unset($conf["stringProcess::delStrAfterKeyWord"]);
|
|
|
83 |
|
|
|
84 |
#如果執行失敗
|
|
|
85 |
if($delStrAfterKeyWord["status"]==="false"){
|
|
|
86 |
|
|
|
87 |
#函式說明:
|
|
|
88 |
#撰寫log
|
|
|
89 |
#回傳結果:
|
|
|
90 |
#$result["status"],狀態,"true"或"false".
|
|
|
91 |
#$result["error"],錯誤訊息陣列.
|
|
|
92 |
#$result["function"],當前函式的名稱.
|
|
|
93 |
#$result["argu"],使用的參數.
|
|
|
94 |
#必填參數:
|
|
|
95 |
#$conf["path"],字串,log檔案的路徑與名稱.
|
|
|
96 |
$conf["path"]=$logFile;
|
|
|
97 |
#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
|
|
|
98 |
$conf["content"]=$delStrAfterKeyWord;
|
|
|
99 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
|
|
|
100 |
$conf["fileArgu"]=__FILE__;
|
|
|
101 |
#可省略參數:
|
|
|
102 |
#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
|
|
|
103 |
#$conf["rewrite"]="false";
|
|
|
104 |
#參考資料:
|
|
|
105 |
#無.
|
|
|
106 |
#備註:
|
|
|
107 |
#無.
|
|
|
108 |
$record=logs::record($conf);
|
|
|
109 |
unset($conf);
|
| 224 |
liveuser |
110 |
|
| 1 |
liveuser |
111 |
#如果寫log失敗
|
|
|
112 |
if($record["status"]==="false"){
|
| 224 |
liveuser |
113 |
|
| 1 |
liveuser |
114 |
#印出結果
|
|
|
115 |
var_dump($record);
|
| 224 |
liveuser |
116 |
|
| 1 |
liveuser |
117 |
}#if end
|
| 224 |
liveuser |
118 |
|
| 1 |
liveuser |
119 |
#結束執行,回傳錯誤代碼1
|
|
|
120 |
exit(1);
|
|
|
121 |
|
|
|
122 |
}#if end
|
| 224 |
liveuser |
123 |
|
| 1 |
liveuser |
124 |
#印出結果
|
|
|
125 |
var_dump($delStrAfterKeyWord);
|
|
|
126 |
|
|
|
127 |
#函式說明:
|
|
|
128 |
#將字串特定關鍵字與其後面的內容剔除
|
|
|
129 |
#回傳結果:
|
|
|
130 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
131 |
#$result["error"],錯誤訊息陣列.
|
|
|
132 |
#$result["warning"],警告訊息鎮列.
|
|
|
133 |
#$result["founded"],有無找到定字串"true"代表有,"false"代表沒有.
|
|
|
134 |
#$result["function"],當前執行的函數名稱.
|
|
|
135 |
#$result["oriStr"],要處理的原始字串內容.
|
|
|
136 |
#$result["content"],處理好的的字串內容.
|
|
|
137 |
#$result["argu"],使用的參數.
|
|
|
138 |
#必填參數:
|
|
|
139 |
#$conf["stringIn"],字串,要處理的字串.
|
|
|
140 |
$conf["stringProcess::delStrAfterKeyWord"]["stringIn"]="How are you?";
|
|
|
141 |
#$conf["keyWord"],字串,特定字串.
|
|
|
142 |
$conf["stringProcess::delStrAfterKeyWord"]["keyWord"]=" ";
|
|
|
143 |
#可省略參數:
|
|
|
144 |
#$conf["deleteLastRepeatedOne"],字串,預設為"false";若為"true"則代表連續遇到同 $conf["keyWord"] 的內容,要將移除內容的起點往後移動到為後一個 $conf["keyWord"].
|
|
|
145 |
$conf["stringProcess::delStrAfterKeyWord"]["deleteLastRepeatedOne"]="true";
|
|
|
146 |
#參考資料:
|
|
|
147 |
#無.
|
|
|
148 |
#備註:
|
|
|
149 |
#無.
|
|
|
150 |
$delStrAfterKeyWord=stringProcess::delStrAfterKeyWord($conf["stringProcess::delStrAfterKeyWord"]);
|
|
|
151 |
unset($conf["stringProcess::delStrAfterKeyWord"]);
|
|
|
152 |
|
|
|
153 |
#如果執行失敗
|
|
|
154 |
if($delStrAfterKeyWord["status"]==="false"){
|
|
|
155 |
|
|
|
156 |
#函式說明:
|
|
|
157 |
#撰寫log
|
|
|
158 |
#回傳結果:
|
|
|
159 |
#$result["status"],狀態,"true"或"false".
|
|
|
160 |
#$result["error"],錯誤訊息陣列.
|
|
|
161 |
#$result["function"],當前函式的名稱.
|
|
|
162 |
#$result["argu"],使用的參數.
|
|
|
163 |
#必填參數:
|
|
|
164 |
#$conf["path"],字串,log檔案的路徑與名稱.
|
|
|
165 |
$conf["path"]=$logFile;
|
|
|
166 |
#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
|
|
|
167 |
$conf["content"]=$delStrAfterKeyWord;
|
|
|
168 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
|
|
|
169 |
$conf["fileArgu"]=__FILE__;
|
|
|
170 |
#可省略參數:
|
|
|
171 |
#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
|
|
|
172 |
#$conf["rewrite"]="false";
|
|
|
173 |
#參考資料:
|
|
|
174 |
#無.
|
|
|
175 |
#備註:
|
|
|
176 |
#無.
|
|
|
177 |
$record=logs::record($conf);
|
|
|
178 |
unset($conf);
|
| 224 |
liveuser |
179 |
|
| 1 |
liveuser |
180 |
#如果寫log失敗
|
|
|
181 |
if($record["status"]==="false"){
|
| 224 |
liveuser |
182 |
|
| 1 |
liveuser |
183 |
#印出結果
|
|
|
184 |
var_dump($record);
|
| 224 |
liveuser |
185 |
|
| 1 |
liveuser |
186 |
}#if end
|
| 224 |
liveuser |
187 |
|
| 1 |
liveuser |
188 |
#結束執行,回傳錯誤代碼1
|
|
|
189 |
exit(1);
|
|
|
190 |
|
|
|
191 |
}#if end
|
| 224 |
liveuser |
192 |
|
| 1 |
liveuser |
193 |
#印出結果
|
|
|
194 |
var_dump($delStrAfterKeyWord);
|
|
|
195 |
|
| 224 |
liveuser |
196 |
?>
|